fixed handling of invalid subfiles

Sat, 01 Jun 2019 10:47:27 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 01 Jun 2019 10:47:27 +0300
changeset 55
388df1fa18a2
parent 54
0c686d10eb49
child 56
ed6d39c59e56

fixed handling of invalid subfiles

tests/subfiles.py file | annotate | diff | comparison | revisions
--- a/tests/subfiles.py	Thu May 30 12:03:53 2019 +0300
+++ b/tests/subfiles.py	Sat Jun 01 10:47:27 2019 +0300
@@ -113,28 +113,29 @@
                     problem_text = subfile.problem,
                 )
                 failed_subfiles.add(path)
-            import re
-            match = re.search(r'^\~Moved(?: to (\w+))?$', subfile.description)
-            if match:
-                yield error(subfile_reference, 'moved-file-used',
-                    moved_file = path,
-                    new_file = match.group(1))
-            scaling_vector = subfile_reference.matrix.scaling_vector()
-            scaled_dimensions = {
-                dimension
-                for dimension in subfile.flatness
-                if not math.isclose(
-                    getattr(scaling_vector, dimension),
-                    1,
-                    abs_tol = 1.0e-05
-                )
-            }
-            scaled_flat_dimensions = subfile.flatness & scaled_dimensions
-            if scaled_flat_dimensions:
-                yield testsuite.notice(subfile_reference, 'unnecessary-scaling',
-                    scaled_flat_dimensions = scaled_flat_dimensions,
-                    scaling_vector = scaling_vector,
-                )
+            else:
+                import re
+                match = re.search(r'^\~Moved(?: to (\w+))?$', subfile.description)
+                if match:
+                    yield error(subfile_reference, 'moved-file-used',
+                        moved_file = path,
+                        new_file = match.group(1))
+                scaling_vector = subfile_reference.matrix.scaling_vector()
+                scaled_dimensions = {
+                    dimension
+                    for dimension in subfile.flatness
+                    if not math.isclose(
+                        getattr(scaling_vector, dimension),
+                        1,
+                        abs_tol = 1.0e-05
+                    )
+                }
+                scaled_flat_dimensions = subfile.flatness & scaled_dimensions
+                if scaled_flat_dimensions:
+                    yield testsuite.notice(subfile_reference, 'unnecessary-scaling',
+                        scaled_flat_dimensions = scaled_flat_dimensions,
+                        scaling_vector = scaling_vector,
+                    )
 
 def dimensions_description(dimensions):
     sorted_dims = sorted(dimensions)

mercurial