Skip to content

Commit 73e175a

Browse files
committed
Split test_insphere into multiple functions based on input data complexity.
The Random3DRotationStrategy test varies widely in runtime based on the complexity of the input shape. Splitting the calling function into two tests (for simple Platonic shapes and more complex Catalan shapes) should solve this issue.
1 parent 5b5fa41 commit 73e175a

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

tests/test_polyhedron.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,16 +456,16 @@ def test_maximal_centered_bounded_sphere_convex_hulls(points, test_points):
456456

457457

458458
# Platonic and Catalan shapes have a centered insphere, but Archimedean
459-
# and Johnson solids do not
460-
@combine_marks(named_platonic_mark, named_catalan_mark)
461-
def test_insphere(poly):
462-
# The insphere should be centered for platonic or catalan solids.
459+
# and Johnson solids do not.
460+
@named_platonic_mark
461+
def test_insphere_platonic(poly):
462+
# The insphere should be centered for platonic solids.
463463
poly_insphere = poly.insphere
464464
assert sphere_isclose(
465465
poly_insphere, poly.maximal_centered_bounded_sphere, atol=1e-5
466466
)
467467

468-
# The insphere of a platonic or catalan solid should be rotation invariant.
468+
# The insphere of a platonic solid should be rotation invariant.
469469
@settings(deadline=500)
470470
@given(Random3DRotationStrategy)
471471
def check_rotation_invariance(quat):
@@ -475,6 +475,24 @@ def check_rotation_invariance(quat):
475475
check_rotation_invariance()
476476

477477

478+
@named_catalan_mark
479+
def test_insphere_catalan(poly):
480+
# The insphere should be centered for catalan solids.
481+
poly_insphere = poly.insphere
482+
assert sphere_isclose(
483+
poly_insphere, poly.maximal_centered_bounded_sphere, atol=1e-5
484+
)
485+
486+
# The insphere of a catalan solid should be rotation invariant.
487+
@settings(deadline=1200)
488+
@given(Random3DRotationStrategy)
489+
def check_rotation_invariance(quat):
490+
rotated_poly = ConvexPolyhedron(rowan.rotate(quat, poly.vertices))
491+
assert sphere_isclose(poly_insphere, rotated_poly.insphere, atol=1e-5)
492+
493+
check_rotation_invariance()
494+
495+
478496
def test_rotate_inertia(tetrahedron):
479497
# Use the input as noise rather than the base points to avoid precision and
480498
# degenerate cases provided by hypothesis.

0 commit comments

Comments
 (0)