@@ -127,7 +127,7 @@ def test_naturaldelta_nomonths(test_input: dt.timedelta, expected: str) -> None:
127127 (dt .timedelta (days = 999_999_999 ), "2,739,726 years" ),
128128 ],
129129)
130- def test_naturaldelta (test_input : int | dt .timedelta , expected : str ) -> None :
130+ def test_naturaldelta (test_input : dt .timedelta | float , expected : str ) -> None :
131131 assert humanize .naturaldelta (test_input ) == expected
132132
133133
@@ -166,11 +166,13 @@ def test_naturaldelta(test_input: int | dt.timedelta, expected: str) -> None:
166166 ("NaN" , "NaN" ),
167167 ],
168168)
169- def test_naturaltime (test_input : dt .datetime , expected : str ) -> None :
169+ def test_naturaltime (
170+ test_input : dt .datetime | dt .timedelta | float , expected : str
171+ ) -> None :
170172 assert humanize .naturaltime (test_input ) == expected
171173
172174
173- def nt_nomonths (d : dt .datetime ) -> str :
175+ def nt_nomonths (d : dt .datetime | dt . timedelta | float ) -> str :
174176 return humanize .naturaltime (d , months = False )
175177
176178
@@ -211,7 +213,9 @@ def nt_nomonths(d: dt.datetime) -> str:
211213 ("NaN" , "NaN" ),
212214 ],
213215)
214- def test_naturaltime_nomonths (test_input : dt .datetime , expected : str ) -> None :
216+ def test_naturaltime_nomonths (
217+ test_input : dt .datetime | dt .timedelta | float , expected : str
218+ ) -> None :
215219 assert nt_nomonths (test_input ) == expected
216220
217221
@@ -437,7 +441,7 @@ def test_naturaltime_minimum_unit_explicit(
437441 ],
438442)
439443def test_precisedelta_one_unit_enough (
440- val : int | dt .timedelta , min_unit : str , expected : str
444+ val : dt .timedelta | float , min_unit : str , expected : str
441445) -> None :
442446 assert humanize .precisedelta (val , minimum_unit = min_unit ) == expected
443447
@@ -493,7 +497,7 @@ def test_precisedelta_one_unit_enough(
493497 ],
494498)
495499def test_precisedelta_multiple_units (
496- val : dt .timedelta , min_unit : str , expected : str
500+ val : dt .timedelta | float , min_unit : str , expected : str
497501) -> None :
498502 assert humanize .precisedelta (val , minimum_unit = min_unit ) == expected
499503
@@ -565,7 +569,7 @@ def test_precisedelta_multiple_units(
565569 ],
566570)
567571def test_precisedelta_custom_format (
568- val : dt .timedelta , min_unit : str , fmt : str , expected : str
572+ val : dt .timedelta | float , min_unit : str , fmt : str , expected : str
569573) -> None :
570574 assert humanize .precisedelta (val , minimum_unit = min_unit , format = fmt ) == expected
571575
@@ -642,7 +646,7 @@ def test_precisedelta_custom_format(
642646 ],
643647)
644648def test_precisedelta_suppress_units (
645- val : dt .timedelta , min_unit : str , suppress : list [str ], expected : str
649+ val : dt .timedelta | float , min_unit : str , suppress : list [str ], expected : str
646650) -> None :
647651 assert (
648652 humanize .precisedelta (val , minimum_unit = min_unit , suppress = suppress ) == expected
0 commit comments