Skip to content

Commit

Permalink
refactored parameters for test across time ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
niksirbi committed Nov 4, 2024
1 parent e09f42d commit 6cc5333
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions tests/test_unit/test_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ def test_approximate_derivative_with_invalid_order(order):
kinematics.compute_time_derivative(data, order=order)


time_points_value_error = pytest.raises(
ValueError,
match="At least 2 time points are required to compute path length",
)


@pytest.mark.parametrize(
"start, stop, expected_exception",
[
Expand All @@ -217,33 +223,11 @@ def test_approximate_derivative_with_invalid_order(order):
(1, 8, does_not_raise()),
(1.5, 8.5, does_not_raise()),
(2, None, does_not_raise()),
# Empty time range (because start > stop)
(
9,
0,
pytest.raises(
ValueError,
match="At least 2 time points",
),
),
# Empty time range (because of invalid start type)
(
"text",
9,
pytest.raises(
ValueError,
match="At least 2 time points",
),
),
# Empty time ranges
(9, 0, time_points_value_error), # start > stop
("text", 9, time_points_value_error), # invalid start type
# Time range too short
(
0,
0.5,
pytest.raises(
ValueError,
match="At least 2 time points",
),
),
(0, 0.5, time_points_value_error),
],
)
def test_path_length_across_time_ranges(
Expand Down

0 comments on commit 6cc5333

Please sign in to comment.