From f0b8598e445f50fdbf9bbdfc887b9b7c6cb4a08d Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Wed, 25 Jan 2023 18:30:33 -0500 Subject: [PATCH] test: Fix assumption on quaternions. Only test quaternions that are not effectively zero. --- tests/test_polygon.py | 4 ++-- tests/test_spheropolygon.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_polygon.py b/tests/test_polygon.py index 4c6d78be..9973f785 100644 --- a/tests/test_polygon.py +++ b/tests/test_polygon.py @@ -189,7 +189,7 @@ def test_convex_area(points): @given(random_quat=arrays(np.float64, (4,), elements=floats(-1, 1, width=64))) def test_rotation_signed_area(random_quat): """Ensure that rotating does not change the signed area.""" - assume(not np.all(random_quat == 0)) + assume(not np.allclose(random_quat, 0)) random_quat = rowan.normalize(random_quat) rotated_points = rowan.rotate(random_quat, get_square_points()) poly = Polygon(rotated_points) @@ -253,7 +253,7 @@ def test_bounding_circle_radius_random_hull(points): ) def test_bounding_circle_radius_random_hull_rotation(points, rotation): """Test that rotating vertices does not change the bounding radius.""" - assume(not np.all(rotation == 0)) + assume(not np.allclose(rotation, 0)) hull = ConvexHull(points) poly = Polygon(points[hull.vertices]) diff --git a/tests/test_spheropolygon.py b/tests/test_spheropolygon.py index a9df4a0e..a1d34b6e 100644 --- a/tests/test_spheropolygon.py +++ b/tests/test_spheropolygon.py @@ -152,7 +152,7 @@ def test_convex_signed_area(square_points): ) ) def testfun(random_quat): - assume(not np.all(random_quat == 0)) + assume(not np.allclose(random_quat, 0)) random_quat = rowan.normalize(random_quat) rotated_points = rowan.rotate(random_quat, square_points) r = 1