Fri, 18 Sep 2020 21:02:44 +0300
unknown metacommand test
73 | 1 | from testsuite import problem_type, report_problem |
2 | import linetypes | |
3 | ||
4 | @problem_type( | |
5 | 'alias-not-prefixed-with-equals', | |
6 | severity = 'hold', | |
7 | message = 'description of alias files must start with a "="', | |
8 | ) | |
9 | @problem_type( | |
10 | 'alias-with-polygon', | |
11 | severity = 'hold', | |
12 | message = 'alias files must only contain subfile references', | |
13 | ) | |
14 | @problem_type( | |
15 | 'alias-bad-colour', | |
16 | severity = 'hold', | |
17 | message = 'alias files must only use colour 16', | |
18 | ) | |
19 | def alias_tests(model): | |
20 | if model.header.valid and 'Alias' in model.header.qualifiers: | |
21 | if not model.header.description.startswith('='): | |
22 | yield report_problem( | |
23 | 'alias-not-prefixed-with-equals', | |
24 | bad_object = model.body[0], | |
25 | ) | |
26 | for element in model.body: | |
27 | if isinstance(element, linetypes.BasePolygon): | |
28 | yield report_problem( | |
29 | 'alias-with-polygon', | |
30 | bad_object = element | |
31 | ) | |
32 | elif hasattr(element, 'colour') and element.colour.index != 16: | |
33 | yield report_problem( | |
34 | 'alias-bad-colour', | |
35 | bad_object = element | |
36 | ) | |
37 | ||
38 | manifest = { | |
39 | 'tests': [ | |
40 | alias_tests | |
41 | ], | |
42 | } |