@@ -99,7 +99,8 @@ def test_line_create_from_point_direction_length(point, direction, length):
9999 line = Line .from_point_direction_length (point , direction , length )
100100
101101 assert line .start == point
102- assert line .end == add_vectors (point , scale_vector (normalize_vector (direction ), length ))
102+ assert line .end == add_vectors (
103+ point , scale_vector (normalize_vector (direction ), length ))
103104
104105
105106# =============================================================================
@@ -228,20 +229,18 @@ def test_line_accessors(p1, p2):
228229 ([- 11.1 , 22.2 , 33.3 ], [1.1 , - 2.2 , - 3.3 ]),
229230 ],
230231)
231- @pytest .mark .parametrize (
232- "distance" ,
233- [0 , 1 , 4 , - 9 , 3.3 , 0.00001 , - 0.00001 ],
234- )
235- def test_line_point_from_start (p1 , p2 , distance ):
236- line = Line (p1 , p2 )
237- point = line .point_from_start (distance )
238- distance_to_start = distance_point_point (point , p1 )
239- distance_to_end = distance_point_point (point , p2 )
240- # Check that the distance is correct
241- assert TOL .is_close (distance_to_start , abs (distance ))
242- # Check that negative distance gives a point far away from end
243- if distance < 0 :
244- assert distance_to_end > line .length
232+ def test_line_point_from_start (p1 , p2 ):
233+ distances = [0 , 1 , 4 , - 9 , 3.3 , 0.00001 , - 0.00001 ]
234+ for distance in distances :
235+ line = Line (p1 , p2 )
236+ point = line .point_from_start (distance )
237+ distance_to_start = distance_point_point (point , p1 )
238+ distance_to_end = distance_point_point (point , p2 )
239+ # Check that the distance is correct
240+ assert TOL .is_close (distance_to_start , abs (distance ))
241+ # Check that negative distance gives a point far away from end
242+ if distance < 0 :
243+ assert distance_to_end > line .length
245244
246245
247246@pytest .mark .parametrize (
0 commit comments