mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
Add a few more tests for duration conversions
This commit is contained in:
parent
daa22708c4
commit
4935a025ce
1 changed files with 7 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue