diff --git a/tests/test_schemas_utils.py b/tests/test_schemas_utils.py index 0732b3a..120ca88 100644 --- a/tests/test_schemas_utils.py +++ b/tests/test_schemas_utils.py @@ -9,9 +9,13 @@ def test_string_to_duration_days(): assert string_to_duration("3w", target="days") == 21 assert string_to_duration("3m", target="days") == 90 assert string_to_duration("1y", target="days") == 365 + with pytest.raises(ValueError): string_to_duration("3h", target="days") + with pytest.raises(ValueError): + string_to_duration("1", target="days") + def test_string_to_duration_hours(): assert string_to_duration("1h", target="hours") == 1 @@ -19,3 +23,6 @@ def test_string_to_duration_hours(): assert string_to_duration("1w", target="hours") == 7 * 24 assert string_to_duration("3w", target="hours") == 21 * 24 assert string_to_duration("3m", target="hours") == 3 * 30 * 24 + + with pytest.raises(ValueError): + string_to_duration("1", target="hours")