From 0f387fd5ced533c7a8a33e8b9c1ec1b04fd5a923 Mon Sep 17 00:00:00 2001 From: Christian Pederkoff <6548797+cpederkoff@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:17:42 -0700 Subject: [PATCH] lint --- stltovoxel/polygon_repair.py | 3 ++- test/{test_winding_query.py => test_polygon_repair.py} | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) rename test/{test_winding_query.py => test_polygon_repair.py} (98%) diff --git a/stltovoxel/polygon_repair.py b/stltovoxel/polygon_repair.py index 8eb9cf1..92c3784 100644 --- a/stltovoxel/polygon_repair.py +++ b/stltovoxel/polygon_repair.py @@ -1,6 +1,7 @@ import numpy as np import math + def find_polylines(segments): # noqa: C901 polylines = [] segment_forward_dict = {} @@ -94,7 +95,7 @@ def atan_sum(f1, f2): # atan2(atan_sum(f1, f2)) == atan2(f1) + atan2(f2) x1, y1 = f1 x2, y2 = f2 - return ( x1*x2 - y1*y2, y1*x2 + x1*y2) + return (x1*x2 - y1*y2, y1*x2 + x1*y2) def atan_neg(f1): diff --git a/test/test_winding_query.py b/test/test_polygon_repair.py similarity index 98% rename from test/test_winding_query.py rename to test/test_polygon_repair.py index 9f03956..f52f76f 100644 --- a/test/test_winding_query.py +++ b/test/test_polygon_repair.py @@ -1,11 +1,10 @@ -import unittest -import math import numpy as np +import unittest from stltovoxel import polygon_repair -class TestWindingQuery(unittest.TestCase): +class TestPolygonRepair(unittest.TestCase): def tuples_almost_equal(self, actual, expected): for ac_val, exp_val in zip(actual, expected): self.assertAlmostEqual(ac_val, exp_val, 3, f"{actual} != {expected}") @@ -68,7 +67,6 @@ def test_grad_90_norm(self): expected = polygon_repair.normalize((-1, -1)) self.tuples_almost_equal(actual, expected) - def test_grad_90_norm2(self): segs = [((0, 0), (1, 0)), ((1, 0), (1, 1)), ((1, 1), (0, 1))] pos = (0, 0.5) @@ -92,7 +90,7 @@ def test_grad_90_norm3(self): actual = polygon_repair.winding_contour(pos, segs) expected = polygon_repair.normalize((-1, -1)) self.tuples_almost_equal(actual, expected) - + if __name__ == '__main__': unittest.main()