Mon, 22 Jan 2018 21:04:53 +0200
added check for invalid colours
25 | 1 | from testsuite import warning |
2 | ||
3 | def colours_test(model): | |
4 | yield from ( | |
5 | warning(element, 'bad-colour', colour_index = element.colour.index) | |
6 | for element in model.body | |
7 | if hasattr(element, 'colour') and not element.colour.is_valid | |
8 | ) | |
9 | ||
10 | manifest = { | |
11 | 'tests': { | |
12 | 'colour-validity': colours_test, | |
13 | }, | |
14 | 'messages': { | |
15 | 'bad-colour': lambda colour_index: str.format( | |
16 | 'invalid colour {}', | |
17 | colour_index, | |
18 | ), | |
19 | }, | |
20 | } |