tests/misc.py

changeset 68
c19dd0d3248e
parent 66
e28b249b4422
child 69
a24c4490d9f2
--- a/tests/misc.py	Sat Jun 22 23:35:03 2019 +0300
+++ b/tests/misc.py	Sat Jun 22 23:38:51 2019 +0300
@@ -92,13 +92,24 @@
     severity = 'hold',
     message = 'primitives must have CCW winding',
 )
-def primitive_ccw_test(model):
-    if model.header.valid \
+@problem_type('no-bfc-line',
+    severity = 'hold',
+    message = 'BFC declaration is missing',
+)
+def header_bfc_test(model):
+    def find_the_bfc_object(model):
+        return model.body[model.header.first_occurrence['bfc']],
+    if model.header.valid and not model.header.bfc:
+        yield report_problem(
+            'no-bfc-line',
+            bad_object = model.body[0],
+        )
+    elif model.header.valid \
     and model.header.filetype.endswith('Primitive') \
     and model.header.bfc != 'CERTIFY CCW':
         yield report_problem(
             'primitive-bfc-ccw',
-            bad_object = model.body[model.header.first_occurrence['bfc']],
+            bad_object = find_the_bfc_object(model),
         )
 
 manifest = {
@@ -109,6 +120,6 @@
         nocertify_test,
         physical_colours_test,
         unofficiality_test,
-        primitive_ccw_test,
+        header_bfc_test,
     ],
 }

mercurial