Skip to content

Commit

Permalink
Test precisedelta with None to increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jul 9, 2022
1 parent 5427300 commit d2bd73e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/humanize/time.py
Expand Up @@ -433,7 +433,7 @@ def _suppress_lower_units(min_unit: Unit, suppress: typing.Iterable[Unit]) -> se


def precisedelta(
value: dt.timedelta | int,
value: dt.timedelta | int | None,
minimum_unit: str = "seconds",
suppress: typing.Iterable[str] = (),
format: str = "%0.2f",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_time.py
Expand Up @@ -629,6 +629,8 @@ def test_precisedelta_suppress_units(


def test_precisedelta_bogus_call() -> None:
assert humanize.precisedelta(None) == "None"

with pytest.raises(ValueError):
humanize.precisedelta(1, minimum_unit="years", suppress=["years"])

Expand Down

0 comments on commit d2bd73e

Please sign in to comment.