tests/misc.py

Fri, 24 May 2019 14:18:28 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 24 May 2019 14:18:28 +0200
changeset 34
7ed2e831acd4
parent 26
7c263b864371
child 38
66c9591b733d
permissions
-rw-r--r--

the program now checks that all ldraw paths are reachable

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,
        ),
    },
}

mercurial