@@ -242,13 +242,11 @@ def test_valid_ink_trajectory(
242242
243243def test_uniform_motion () -> None :
244244 """Test with points moving at constant velocity."""
245- points = pd .DataFrame (
246- {
247- "x" : [0 , 1 , 2 , 3 ],
248- "y" : [0 , 0 , 0 , 0 ],
249- "seconds" : [0 , 1 , 2 , 3 ],
250- }
251- )
245+ points = pd .DataFrame ({
246+ "x" : [0 , 1 , 2 , 3 ],
247+ "y" : [0 , 0 , 0 , 0 ],
248+ "seconds" : [0 , 1 , 2 , 3 ],
249+ })
252250 segment = models .LineSegment (
253251 start_label = "1" ,
254252 end_label = "2" ,
@@ -260,24 +258,20 @@ def test_uniform_motion() -> None:
260258
261259 segment .calculate_velocity_metrics ()
262260
263- assert segment .distance == pytest .approx (3.0 )
264- assert segment .mean_speed == pytest .approx (1.0 )
265- assert segment .speed_variance == pytest .approx (0.0 )
266- assert len (segment .velocities ) == 3
267- assert all (v == pytest .approx (1.0 ) for v in segment .velocities )
268- assert len (segment .accelerations ) == 2
269- assert all (a == pytest .approx (0.0 ) for a in segment .accelerations )
261+ assert segment .distance == 3.0
262+ assert segment .mean_speed == 1.0
263+ assert segment .speed_variance == 0.0
264+ assert segment .velocities == [1.0 , 1.0 , 1.0 ]
265+ assert segment .accelerations == [0.0 , 0.0 ]
270266
271267
272268def test_accelerating_motion () -> None :
273269 """Test with motion accelerating over time."""
274- points = pd .DataFrame (
275- {
276- "x" : [0 , 1 , 4 , 9 ],
277- "y" : [0 , 0 , 0 , 0 ],
278- "seconds" : [0 , 1 , 2 , 3 ],
279- }
280- )
270+ points = pd .DataFrame ({
271+ "x" : [0 , 1 , 4 , 9 ],
272+ "y" : [0 , 0 , 0 , 0 ],
273+ "seconds" : [0 , 1 , 2 , 3 ],
274+ })
281275 segment = models .LineSegment (
282276 start_label = "1" ,
283277 end_label = "2" ,
@@ -303,13 +297,11 @@ def test_accelerating_motion() -> None:
303297
304298def test_velocity_two_points_only () -> None :
305299 """Test velocity calculation with only two points."""
306- points = pd .DataFrame (
307- {
308- "x" : [0 , 3 ],
309- "y" : [0 , 4 ],
310- "seconds" : [0 , 2 ],
311- }
312- )
300+ points = pd .DataFrame ({
301+ "x" : [0 , 3 ],
302+ "y" : [0 , 4 ],
303+ "seconds" : [0 , 2 ],
304+ })
313305 segment = models .LineSegment (
314306 start_label = "1" ,
315307 end_label = "2" ,
@@ -331,13 +323,11 @@ def test_velocity_two_points_only() -> None:
331323
332324def test_decelerating_motion () -> None :
333325 """Test with decelerating motion (negative acceleration)."""
334- points = pd .DataFrame (
335- {
336- "x" : [0 , 4 , 7 , 9 ],
337- "y" : [0 , 0 , 0 , 0 ],
338- "seconds" : [0 , 1 , 2 , 3 ],
339- }
340- )
326+ points = pd .DataFrame ({
327+ "x" : [0 , 4 , 7 , 9 ],
328+ "y" : [0 , 0 , 0 , 0 ],
329+ "seconds" : [0 , 1 , 2 , 3 ],
330+ })
341331 segment = models .LineSegment (
342332 start_label = "1" ,
343333 end_label = "2" ,
@@ -363,13 +353,11 @@ def test_decelerating_motion() -> None:
363353
364354def test_stationary_motion () -> None :
365355 """Test with no movement (all points the same)."""
366- points = pd .DataFrame (
367- {
368- "x" : [1 , 1 , 1 ],
369- "y" : [1 , 1 , 1 ],
370- "seconds" : [0 , 1 , 2 ],
371- }
372- )
356+ points = pd .DataFrame ({
357+ "x" : [1 , 1 , 1 ],
358+ "y" : [1 , 1 , 1 ],
359+ "seconds" : [0 , 1 , 2 ],
360+ })
373361 segment = models .LineSegment (
374362 start_label = "1" ,
375363 end_label = "2" ,
@@ -392,13 +380,11 @@ def test_stationary_motion() -> None:
392380
393381def test_no_hesitations_uniform_motion () -> None :
394382 """Test with uniform motion where all velocities are equal."""
395- points = pd .DataFrame (
396- {
397- "x" : [0 , 1 , 2 , 3 ],
398- "y" : [0 , 0 , 0 , 0 ],
399- "seconds" : [0 , 1 , 2 , 3 ],
400- }
401- )
383+ points = pd .DataFrame ({
384+ "x" : [0 , 1 , 2 , 3 ],
385+ "y" : [0 , 0 , 0 , 0 ],
386+ "seconds" : [0 , 1 , 2 , 3 ],
387+ })
402388 segment = models .LineSegment (
403389 start_label = "1" ,
404390 end_label = "2" ,
@@ -417,13 +403,11 @@ def test_no_hesitations_uniform_motion() -> None:
417403
418404def test_hesitation_at_start () -> None :
419405 """Test when the line starts with a hesitation."""
420- points = pd .DataFrame (
421- {
422- "x" : [0 , 0.1 , 1 , 2 ],
423- "y" : [0 , 0.1 , 0 , 0 ],
424- "seconds" : [0 , 1 , 2 , 3 ],
425- }
426- )
406+ points = pd .DataFrame ({
407+ "x" : [0 , 0.1 , 1 , 2 ],
408+ "y" : [0 , 0.1 , 0 , 0 ],
409+ "seconds" : [0 , 1 , 2 , 3 ],
410+ })
427411 segment = models .LineSegment (
428412 start_label = "1" ,
429413 end_label = "2" ,
@@ -442,13 +426,11 @@ def test_hesitation_at_start() -> None:
442426
443427def test_multiple_hesitations () -> None :
444428 """Test when there are multiple hesitation periods."""
445- points = pd .DataFrame (
446- {
447- "x" : [0 , 100 , 100.1 , 200 , 200.1 , 300 , 400 , 500 , 600 ],
448- "y" : [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
449- "seconds" : [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ],
450- }
451- )
429+ points = pd .DataFrame ({
430+ "x" : [0 , 100 , 100.1 , 200 , 200.1 , 300 , 400 , 500 , 600 ],
431+ "y" : [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
432+ "seconds" : [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ],
433+ })
452434 segment = models .LineSegment (
453435 start_label = "1" ,
454436 end_label = "2" ,
@@ -467,13 +449,11 @@ def test_multiple_hesitations() -> None:
467449
468450def test_less_than_three_velocities () -> None :
469451 """Test early return when velocities length is less than 3."""
470- points = pd .DataFrame (
471- {
472- "x" : [0 , 1 ],
473- "y" : [0 , 0 ],
474- "seconds" : [0 , 1 ],
475- }
476- )
452+ points = pd .DataFrame ({
453+ "x" : [0 , 1 ],
454+ "y" : [0 , 0 ],
455+ "seconds" : [0 , 1 ],
456+ })
477457 segment = models .LineSegment (
478458 start_label = "1" ,
479459 end_label = "2" ,
0 commit comments