Skip to content

Commit

Permalink
Test time deltas as positive and negative
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Feb 24, 2024
1 parent 7941145 commit ec99f29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def test_naturaldelta_nomonths(test_input: dt.timedelta, expected: str) -> None:
(23.5, "23 seconds"),
(30, "30 seconds"),
(dt.timedelta(microseconds=13), "a moment"),
(dt.timedelta(microseconds=-13), "a moment"),
(dt.timedelta(minutes=1, seconds=30), "a minute"),
(dt.timedelta(minutes=2), "2 minutes"),
(dt.timedelta(hours=1, minutes=30, seconds=30), "an hour"),
Expand Down Expand Up @@ -131,6 +130,8 @@ def test_naturaldelta_nomonths(test_input: dt.timedelta, expected: str) -> None:
)
def test_naturaldelta(test_input: int | dt.timedelta, expected: str) -> None:
assert humanize.naturaldelta(test_input) == expected
if not isinstance(test_input, str):
assert humanize.naturaldelta(-test_input) == expected


@freeze_time("2020-02-02")
Expand Down

0 comments on commit ec99f29

Please sign in to comment.