--- a/tests/misc.py Sat May 25 09:41:33 2019 +0200 +++ b/tests/misc.py Sat May 25 18:37:55 2019 +0200 @@ -25,11 +25,33 @@ reason = model.header.reason, ) +def nocertify_test(model): + import header + if model.header.valid and model.header.bfc == 'NOCERTIFY': + yield error( + model.body[model.header.first_occurrence['bfc']], + 'bfc-nocertify') + +def physical_colours_test(model): + if model.header.valid and 'Physical_Colour' in model.header.qualifiers: + yield error( + model.body[model.header.first_occurrence['part type']], + 'physical-colour') + +def unofficiality_test(model): + if model.header.valid and not model.header.filetype.startswith('Unofficial_'): + yield error( + model.body[model.header.first_occurrence['part type']], + 'unofficial-type') + manifest = { 'tests': { 'colour-validity': colours_test, 'syntax-errors': syntax_errors, 'header-validity': bad_header, + 'bfc-nocertify': nocertify_test, + 'physical-colour': physical_colours_test, + 'unofficial-type': unofficiality_test, }, 'messages': { 'bad-colour': lambda colour_index: str.format( @@ -44,5 +66,8 @@ 'bad header: {}', reason, ), + 'bfc-nocertify': 'all new parts must be BFC certified', + 'physical-colour': 'no new physical colour parts are accepted', + 'unofficial-type': 'new parts must be unofficial', }, }