Skip to content

Commit 215f701

Browse files
committed
ruff reformat
1 parent 0c40daf commit 215f701

2 files changed

Lines changed: 88 additions & 62 deletions

File tree

tests/unit/test_models.py

Lines changed: 76 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,13 @@ def test_valid_ink_trajectory(
243243

244244
def test_uniform_motion() -> None:
245245
"""Test with points moving at constant velocity."""
246-
points = pd.DataFrame({
247-
"x": [0, 1, 2, 3],
248-
"y": [0, 0, 0, 0],
249-
"seconds": [0, 1, 2, 3],
250-
})
246+
points = pd.DataFrame(
247+
{
248+
"x": [0, 1, 2, 3],
249+
"y": [0, 0, 0, 0],
250+
"seconds": [0, 1, 2, 3],
251+
}
252+
)
251253
segment = models.LineSegment(
252254
start_label="1",
253255
end_label="2",
@@ -270,11 +272,13 @@ def test_uniform_motion() -> None:
270272

271273
def test_accelerating_motion() -> None:
272274
"""Test with motion accelerating over time."""
273-
points = pd.DataFrame({
274-
"x": [0, 1, 4, 9],
275-
"y": [0, 0, 0, 0],
276-
"seconds": [0, 1, 2, 3],
277-
})
275+
points = pd.DataFrame(
276+
{
277+
"x": [0, 1, 4, 9],
278+
"y": [0, 0, 0, 0],
279+
"seconds": [0, 1, 2, 3],
280+
}
281+
)
278282
segment = models.LineSegment(
279283
start_label="1",
280284
end_label="2",
@@ -300,11 +304,13 @@ def test_accelerating_motion() -> None:
300304

301305
def test_velocity_two_points_only() -> None:
302306
"""Test velocity calculation with only two points."""
303-
points = pd.DataFrame({
304-
"x": [0, 3],
305-
"y": [0, 4],
306-
"seconds": [0, 2],
307-
})
307+
points = pd.DataFrame(
308+
{
309+
"x": [0, 3],
310+
"y": [0, 4],
311+
"seconds": [0, 2],
312+
}
313+
)
308314
segment = models.LineSegment(
309315
start_label="1",
310316
end_label="2",
@@ -326,11 +332,13 @@ def test_velocity_two_points_only() -> None:
326332

327333
def test_decelerating_motion() -> None:
328334
"""Test with decelerating motion (negative acceleration)."""
329-
points = pd.DataFrame({
330-
"x": [0, 4, 7, 9],
331-
"y": [0, 0, 0, 0],
332-
"seconds": [0, 1, 2, 3],
333-
})
335+
points = pd.DataFrame(
336+
{
337+
"x": [0, 4, 7, 9],
338+
"y": [0, 0, 0, 0],
339+
"seconds": [0, 1, 2, 3],
340+
}
341+
)
334342
segment = models.LineSegment(
335343
start_label="1",
336344
end_label="2",
@@ -356,11 +364,13 @@ def test_decelerating_motion() -> None:
356364

357365
def test_stationary_motion() -> None:
358366
"""Test with no movement (all points the same)."""
359-
points = pd.DataFrame({
360-
"x": [1, 1, 1],
361-
"y": [1, 1, 1],
362-
"seconds": [0, 1, 2],
363-
})
367+
points = pd.DataFrame(
368+
{
369+
"x": [1, 1, 1],
370+
"y": [1, 1, 1],
371+
"seconds": [0, 1, 2],
372+
}
373+
)
364374
segment = models.LineSegment(
365375
start_label="1",
366376
end_label="2",
@@ -383,11 +393,13 @@ def test_stationary_motion() -> None:
383393

384394
def test_no_hesitations_uniform_motion() -> None:
385395
"""Test with uniform motion where all velocities are equal."""
386-
points = pd.DataFrame({
387-
"x": [0, 1, 2, 3],
388-
"y": [0, 0, 0, 0],
389-
"seconds": [0, 1, 2, 3],
390-
})
396+
points = pd.DataFrame(
397+
{
398+
"x": [0, 1, 2, 3],
399+
"y": [0, 0, 0, 0],
400+
"seconds": [0, 1, 2, 3],
401+
}
402+
)
391403
segment = models.LineSegment(
392404
start_label="1",
393405
end_label="2",
@@ -406,11 +418,13 @@ def test_no_hesitations_uniform_motion() -> None:
406418

407419
def test_hesitation_at_start() -> None:
408420
"""Test when the line starts with a hesitation."""
409-
points = pd.DataFrame({
410-
"x": [0, 0.1, 1, 2],
411-
"y": [0, 0.1, 0, 0],
412-
"seconds": [0, 1, 2, 3],
413-
})
421+
points = pd.DataFrame(
422+
{
423+
"x": [0, 0.1, 1, 2],
424+
"y": [0, 0.1, 0, 0],
425+
"seconds": [0, 1, 2, 3],
426+
}
427+
)
414428
segment = models.LineSegment(
415429
start_label="1",
416430
end_label="2",
@@ -429,11 +443,13 @@ def test_hesitation_at_start() -> None:
429443

430444
def test_multiple_hesitations() -> None:
431445
"""Test when there are multiple hesitation periods."""
432-
points = pd.DataFrame({
433-
"x": [0, 100, 100.1, 200, 200.1, 300, 400, 500, 600],
434-
"y": [0, 0, 0, 0, 0, 0, 0, 0, 0],
435-
"seconds": [0, 1, 2, 3, 4, 5, 6, 7, 8],
436-
})
446+
points = pd.DataFrame(
447+
{
448+
"x": [0, 100, 100.1, 200, 200.1, 300, 400, 500, 600],
449+
"y": [0, 0, 0, 0, 0, 0, 0, 0, 0],
450+
"seconds": [0, 1, 2, 3, 4, 5, 6, 7, 8],
451+
}
452+
)
437453
segment = models.LineSegment(
438454
start_label="1",
439455
end_label="2",
@@ -452,11 +468,13 @@ def test_multiple_hesitations() -> None:
452468

453469
def test_less_than_three_velocities() -> None:
454470
"""Test early return when velocities length is less than 3."""
455-
points = pd.DataFrame({
456-
"x": [0, 1],
457-
"y": [0, 0],
458-
"seconds": [0, 1],
459-
})
471+
points = pd.DataFrame(
472+
{
473+
"x": [0, 1],
474+
"y": [0, 0],
475+
"seconds": [0, 1],
476+
}
477+
)
460478
segment = models.LineSegment(
461479
start_label="1",
462480
end_label="2",
@@ -475,11 +493,13 @@ def test_less_than_three_velocities() -> None:
475493

476494
def test_smoothness_less_than_three_points() -> None:
477495
"""Less than 3 points cannot define curvature."""
478-
points = pd.DataFrame({
479-
"x": [0, 1],
480-
"y": [0, 0],
481-
"seconds": [0, 1],
482-
})
496+
points = pd.DataFrame(
497+
{
498+
"x": [0, 1],
499+
"y": [0, 0],
500+
"seconds": [0, 1],
501+
}
502+
)
483503
segment = models.LineSegment(
484504
start_label="1",
485505
end_label="2",
@@ -569,10 +589,12 @@ def test_smoothness_single_180_degree_turn() -> None:
569589
570590
Since it represents maximal curvature.
571591
"""
572-
points = pd.DataFrame({
573-
"x": [0, 1, 0],
574-
"y": [0, 0, 0],
575-
})
592+
points = pd.DataFrame(
593+
{
594+
"x": [0, 1, 0],
595+
"y": [0, 0, 0],
596+
}
597+
)
576598
segment = models.LineSegment(
577599
start_label="1",
578600
end_label="2",

tests/unit/test_trails_drawing_metrics.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
def test_get_total_errors() -> None:
1313
"""Test ValueError when total_number_of_errors column doesn't exist."""
14-
invalid_df = pd.DataFrame({
15-
"some_other_column": [0, 1, 2],
16-
"seconds": [0.0, 1.0, 2.0],
17-
})
14+
invalid_df = pd.DataFrame(
15+
{
16+
"some_other_column": [0, 1, 2],
17+
"seconds": [0.0, 1.0, 2.0],
18+
}
19+
)
1820
drawing = models.Drawing(
1921
data=invalid_df, task_name="trails", metadata={"id": "5555555"}
2022
)
@@ -37,10 +39,12 @@ def test_valid_total_errors() -> None:
3739

3840
def test_percent_accurate_paths_missing_columns() -> None:
3941
"""Test ValueError when required columns are missing."""
40-
invalid_df = pd.DataFrame({
41-
"some_other_column": [0, 1, 2],
42-
"seconds": [0.0, 1.0, 2.0],
43-
})
42+
invalid_df = pd.DataFrame(
43+
{
44+
"some_other_column": [0, 1, 2],
45+
"seconds": [0.0, 1.0, 2.0],
46+
}
47+
)
4448
drawing = models.Drawing(
4549
data=invalid_df, task_name="trails", metadata={"id": "5555555"}
4650
)

0 commit comments

Comments
 (0)