Skip to content

Commit 4ab65ff

Browse files
Copilottaughz
authored andcommitted
Move three-plane tests to the end of the test file
Avoids a textual conflict with other PRs that add tests after the line distance tests, and restores the executable bit on the test file, which runs as a script.
1 parent fa014b4 commit 4ab65ff

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

‎tests/test_geom3d.py‎

100644100755
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,34 +47,6 @@ def test_line_distance_parallel_tolerance():
4747
assert line1.distance(line2, tol=1e8) == pytest.approx(np.sqrt(5))
4848

4949

50-
@pytest.mark.parametrize("point", [[0, 0, 0], [1, 2, 3], [-1.5, 2, 3.25]])
51-
@pytest.mark.parametrize(
52-
"normals", [np.eye(3), np.array([[1, 2, 0], [0, 1, 3], [2, 0, 1]])]
53-
)
54-
@pytest.mark.parametrize("scales", [[1, 1, 1], [-2, 0.5, 3]])
55-
def test_three_plane_intersection(point, normals, scales):
56-
normals = normals * np.array(scales)[:, None]
57-
planes = [Plane3.PointNormal(point, normal) for normal in normals]
58-
intersection = Plane3.intersection(*planes)
59-
60-
assert intersection.shape == (3,)
61-
nt.assert_allclose(intersection, point, atol=1e-12)
62-
# Each plane is defined by n @ x + d = 0, regardless of coefficient scale.
63-
nt.assert_allclose(
64-
normals @ intersection + np.array([plane.d for plane in planes]),
65-
0,
66-
atol=1e-12,
67-
)
68-
nt.assert_allclose(Plane3.intersection(*reversed(planes)), point, atol=1e-12)
69-
70-
71-
@pytest.mark.parametrize("offset", [0, 1])
72-
def test_three_plane_intersection_singular(offset):
73-
planes = [Plane3([1, 0, 0, 0]), Plane3([1, 0, 0, offset]), Plane3([0, 1, 0, 0])]
74-
with pytest.raises(np.linalg.LinAlgError):
75-
Plane3.intersection(*planes)
76-
77-
7850
class Line3Test(unittest.TestCase):
7951
# Primitives
8052
def test_constructor1(self):
@@ -433,5 +405,33 @@ def test_methods(self):
433405
# py.intersect_plane(plane)
434406

435407

408+
@pytest.mark.parametrize("point", [[0, 0, 0], [1, 2, 3], [-1.5, 2, 3.25]])
409+
@pytest.mark.parametrize(
410+
"normals", [np.eye(3), np.array([[1, 2, 0], [0, 1, 3], [2, 0, 1]])]
411+
)
412+
@pytest.mark.parametrize("scales", [[1, 1, 1], [-2, 0.5, 3]])
413+
def test_three_plane_intersection(point, normals, scales):
414+
normals = normals * np.array(scales)[:, None]
415+
planes = [Plane3.PointNormal(point, normal) for normal in normals]
416+
intersection = Plane3.intersection(*planes)
417+
418+
assert intersection.shape == (3,)
419+
nt.assert_allclose(intersection, point, atol=1e-12)
420+
# Each plane is defined by n @ x + d = 0, regardless of coefficient scale.
421+
nt.assert_allclose(
422+
normals @ intersection + np.array([plane.d for plane in planes]),
423+
0,
424+
atol=1e-12,
425+
)
426+
nt.assert_allclose(Plane3.intersection(*reversed(planes)), point, atol=1e-12)
427+
428+
429+
@pytest.mark.parametrize("offset", [0, 1])
430+
def test_three_plane_intersection_singular(offset):
431+
planes = [Plane3([1, 0, 0, 0]), Plane3([1, 0, 0, offset]), Plane3([0, 1, 0, 0])]
432+
with pytest.raises(np.linalg.LinAlgError):
433+
Plane3.intersection(*planes)
434+
435+
436436
if __name__ == "__main__":
437437
unittest.main()

0 commit comments

Comments
 (0)