tests/mirrored-studs.py

Mon, 24 Jun 2019 11:48:52 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 24 Jun 2019 11:48:52 +0300
changeset 91
c71a7d863c2e
parent 89
d2b277cb948e
permissions
-rw-r--r--

removed the typename methods

from testsuite import problem_type, report_problem
import linetypes
from librarystandards import library_standards

@problem_type('mirrored-studs',
    severity = 'warning',
    message = lambda primitive: str.format(
        '"{primitive}" should not be mirrored',
        primitive = primitive,
    )
)
def mirrored_studs_test(model):
    for subfile_reference in model.subfile_references:
        # Test whether any stud subfile is mirrored.
        # A subfile is mirrored if its determinant is negative.
        if subfile_reference.subfile_path.startswith('stu') \
        and subfile_reference.subfile_path != 'stud4.dat' \
        and subfile_reference.matrix.determinant() < 0:
            yield report_problem(
                'mirrored-studs',
                bad_object = subfile_reference,
                primitive = subfile_reference.subfile_path,
            )

manifest = {'tests': [mirrored_studs_test]}

mercurial