Wed, 31 Jan 2018 14:54:58 +0200
fixed python3.6ism
from testsuite import warning def colours_test(model): ''' Checks that all colours used in the part model are valid. ''' yield from ( warning(element, 'bad-colour', colour_index = element.colour.index) for element in model.body if hasattr(element, 'colour') and not element.colour.is_valid ) manifest = { 'tests': { 'colour-validity': colours_test, }, 'messages': { 'bad-colour': lambda colour_index: str.format( 'invalid colour {}', colour_index, ), }, }