tests/subfiles.py

changeset 64
1c0884f5506e
parent 62
f0a6bf48b05e
child 79
eb93feb6d3a3
equal deleted inserted replaced
63:8949af6a4279 64:1c0884f5506e
10 10
11 with ini_path.open() as file: 11 with ini_path.open() as file:
12 library_standards.read_file(file) 12 library_standards.read_file(file)
13 13
14 @problem_type('zero-determinant', 14 @problem_type('zero-determinant',
15 severity = 'error', 15 severity = 'hold',
16 message = 'matrix row or column all zero' 16 message = 'matrix row or column all zero'
17 ) 17 )
18 def determinant_test(model): 18 def determinant_test(model):
19 ''' 19 '''
20 Checks all subfile references for matrices with rows or columns all 20 Checks all subfile references for matrices with rows or columns all
57 abs(abs(scaling.y) - 1) < 1e-5, 57 abs(abs(scaling.y) - 1) < 1e-5,
58 ]), 58 ]),
59 } 59 }
60 60
61 @problem_type('illegal-scaling', 61 @problem_type('illegal-scaling',
62 severity = 'error', 62 severity = 'hold',
63 message = lambda primitive, scaling, axes: 63 message = lambda primitive, scaling, axes:
64 str.format('scaling of unscalable primitive {} ({})', 64 str.format('scaling of unscalable primitive {} ({})',
65 primitive, 65 primitive,
66 scaling_description(scaling, axes), 66 scaling_description(scaling, axes),
67 ), 67 ),
101 axes = interesting_axes, 101 axes = interesting_axes,
102 scaling = scaling, 102 scaling = scaling,
103 ) 103 )
104 104
105 @problem_type('cyclical-reference', 105 @problem_type('cyclical-reference',
106 severity = 'error', 106 severity = 'hold',
107 message = lambda chain: 107 message = lambda chain:
108 str.format('cyclical subfile dependency: {chain}', 108 str.format('cyclical subfile dependency: {chain}',
109 **locals(), 109 **locals(),
110 ), 110 ),
111 ) 111 )
112 @problem_type('bad-subfile', 112 @problem_type('bad-subfile',
113 severity = 'error', 113 severity = 'hold',
114 message = lambda path, problem_text: 114 message = lambda path, problem_text:
115 str.format('cannot process subfile "{path}": {problem_text}', 115 str.format('cannot process subfile "{path}": {problem_text}',
116 **locals(), 116 **locals(),
117 ), 117 ),
118 ) 118 )
119 @problem_type('moved-file-used', 119 @problem_type('moved-file-used',
120 severity = 'error', 120 severity = 'hold',
121 message = lambda moved_file, new_file: 121 message = lambda moved_file, new_file:
122 str.format('subfile "{moved_file}" has been moved to "{new_file}"', 122 str.format('subfile "{moved_file}" has been moved to "{new_file}"',
123 **locals(), 123 **locals(),
124 ), 124 ),
125 ) 125 )
126 @problem_type('unnecessary-scaling', 126 @problem_type('unnecessary-scaling',
127 severity = 'notice', 127 severity = 'warning',
128 message = lambda scaled_flat_dimensions, scaling_vector: 128 message = lambda scaled_flat_dimensions, scaling_vector:
129 str.format( 129 str.format(
130 'subfile unnecessarily scaled in the {dims} ({scaling})', 130 'subfile unnecessarily scaled in the {dims} ({scaling})',
131 dims = dimensions_description(scaled_flat_dimensions), 131 dims = dimensions_description(scaled_flat_dimensions),
132 scaling = scaling_description(scaling_vector), 132 scaling = scaling_description(scaling_vector),

mercurial