Skip to content

Commit

Permalink
test: Fix assumption on quaternions.
Browse files Browse the repository at this point in the history
Only test quaternions that are not effectively zero.
  • Loading branch information
b-butler committed Jan 25, 2023
1 parent 9cb98bb commit f0b8598
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/test_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_spheropolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f0b8598

Please sign in to comment.