Skip to content

Commit

Permalink
docs(tests): Add tests for different kinds of degenerate geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Sep 27, 2024
1 parent 529c1cd commit 2812116
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/face3d_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,27 @@ def test_remove_colinear_vertices():
assert len(face_6.remove_colinear_vertices(0.0001).vertices) == 4


def test_remove_colinear_vertices_degenerate():
"""Test the remove_colinear_vertices method on degenerate geometry."""
pts_1 = (Point3D(0, 0), Point3D(2, 0), Point3D(0, 0))
pts_2 = (Point3D(0, 0), Point3D(2, 0), Point3D(0, 0), Point3D(2, 0))
pts_3 = (Point3D(0, 0), Point3D(0, 0), Point3D(0, 0))
pts_4 = (Point3D(0, 0), Point3D(2, 0), Point3D(2, 2), Point3D(2, 0), Point3D(0, 0))
face_1 = Face3D(pts_1)
face_2 = Face3D(pts_2)
face_3 = Face3D(pts_3)
face_4 = Face3D(pts_4)

with pytest.raises(AssertionError):
face_1.remove_colinear_vertices(0.0001).vertices
with pytest.raises(AssertionError):
face_2.remove_colinear_vertices(0.0001).vertices
with pytest.raises(AssertionError):
face_3.remove_colinear_vertices(0.0001).vertices
with pytest.raises(AssertionError):
face_4.remove_colinear_vertices(0.0001).vertices


def test_remove_colinear_vertices_custom():
"""Test the remove_colinear_vertices method with some custom geometry."""
geo_file = './tests/json/dup_vert_face.json'
Expand Down

0 comments on commit 2812116

Please sign in to comment.