1+ """Test the GeometryHelper class."""
2+
13import numpy as np
24import pytest
35
1315 ([0 , 0 ], [0 , 1 ], [- 1 , 0 ], True ),
1416 ([0 , 0 ], [1 , 0 ], [1 , 1 ], True ),
1517 ([0 , 0 ], [1 , 0 ], [1 , - 1 ], False ),
16- ([0 , 0 ], [1 , 0 ], [2 , 0 ], ValueError ),
18+ ([0 , 0 ], [1 , 0 ], [2 , 0 ], "Point is on the line" ),
1719 ],
1820)
19- def test_is_left (line_point , line_direction , test_point , expected ):
21+ def test_is_left (
22+ line_point : list [int ],
23+ line_direction : list [int ],
24+ test_point : list [int ],
25+ * ,
26+ expected : bool | str ,
27+ ) -> None :
28+ """Test GeometryHelper.is_left."""
2029 if isinstance (expected , bool ):
2130 assert (
2231 GeometryHelper .is_left (
@@ -27,7 +36,7 @@ def test_is_left(line_point, line_direction, test_point, expected):
2736 == expected
2837 )
2938 else :
30- with pytest .raises (expected ):
39+ with pytest .raises (ValueError , match = expected ):
3140 GeometryHelper .is_left (
3241 line_point = np .array (line_point ),
3342 line_direction = np .array (line_direction ),
@@ -50,7 +59,13 @@ def test_is_left(line_point, line_direction, test_point, expected):
5059 ([0 , 1 , 1 ], [1 , 1 , 1 ], [1 , 0 , 0 ], 180 ),
5160 ],
5261)
53- def test_angle_between_point_and_ray (point , ray_point , ray_dir , expected_angle ):
62+ def test_angle_between_point_and_ray (
63+ point : list [int ],
64+ ray_point : list [int ],
65+ ray_dir : list [int ],
66+ expected_angle : int ,
67+ ) -> None :
68+ """Test GeometryHelper.angle_between_point_and_ray."""
5469 angle = GeometryHelper .angle_between_point_and_ray (
5570 point = np .array (point ),
5671 ray_point = np .array (ray_point ),
@@ -69,7 +84,15 @@ def test_angle_between_point_and_ray(point, ray_point, ray_dir, expected_angle):
6984 ([0 , 0 ], [1 , 0 ], [1 , 0 ], [- 1 , 0 ], "Colinear" ),
7085 ],
7186)
72- def test_rays_intersect (point_1 , normal_1 , point_2 , normal_2 , expected ):
87+ def test_rays_intersect (
88+ point_1 : list [int ],
89+ normal_1 : list [int ],
90+ point_2 : list [int ],
91+ normal_2 : list [int ],
92+ * ,
93+ expected : bool | str ,
94+ ) -> None :
95+ """Test GeometryHelper.rays_intersect."""
7396 if isinstance (expected , bool ):
7497 assert (
7598 GeometryHelper .rays_intersect (
0 commit comments