tests/misc.py

changeset 50
0193f8820ba8
parent 48
38b0919c1934
child 62
f0a6bf48b05e
equal deleted inserted replaced
49:a1f5c12fa45c 50:0193f8820ba8
42 if model.header.valid and not model.header.filetype.startswith('Unofficial_'): 42 if model.header.valid and not model.header.filetype.startswith('Unofficial_'):
43 yield error( 43 yield error(
44 model.body[model.header.first_occurrence['part type']], 44 model.body[model.header.first_occurrence['part type']],
45 'unofficial-type') 45 'unofficial-type')
46 46
47 def primitive_ccw_test(model):
48 if model.header.valid \
49 and model.header.filetype.endswith('Primitive') \
50 and model.header.bfc != 'CERTIFY CCW':
51 yield error(
52 model.body[model.header.first_occurrence['bfc']],
53 'primitive-bfc-ccw')
54
47 manifest = { 55 manifest = {
48 'tests': { 56 'tests': {
49 'colour-validity': colours_test, 57 'colour-validity': colours_test,
50 'syntax-errors': syntax_errors, 58 'syntax-errors': syntax_errors,
51 'header-validity': bad_header, 59 'header-validity': bad_header,
52 'bfc-nocertify': nocertify_test, 60 'bfc-nocertify': nocertify_test,
53 'physical-colour': physical_colours_test, 61 'physical-colour': physical_colours_test,
54 'unofficial-type': unofficiality_test, 62 'unofficial-type': unofficiality_test,
63 'primitive-ccw': primitive_ccw_test,
55 }, 64 },
56 'messages': { 65 'messages': {
57 'bad-colour': lambda colour_index: str.format( 66 'bad-colour': lambda colour_index: str.format(
58 'invalid colour {}', 67 'invalid colour {}',
59 colour_index, 68 colour_index,
67 reason, 76 reason,
68 ), 77 ),
69 'bfc-nocertify': 'all new parts must be BFC certified', 78 'bfc-nocertify': 'all new parts must be BFC certified',
70 'physical-colour': 'no new physical colour parts are accepted', 79 'physical-colour': 'no new physical colour parts are accepted',
71 'unofficial-type': 'new parts must be unofficial', 80 'unofficial-type': 'new parts must be unofficial',
81 'primitive-bfc-ccw': 'primitives must have CCW winding',
72 }, 82 },
73 } 83 }

mercurial