Skip to content

Commit f0b3547

Browse files
committed
Update unit checking with more non-time units
Make us of parametrization for simpler code.
1 parent 2ea5d98 commit f0b3547

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/test_parse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def test_units_to_seconds(converter):
4040
assert converter.unit_to_seconds("d") == 86400.0
4141
assert converter.unit_to_seconds("year") == 31557600.0
4242

43+
44+
@pytest.mark.parametrize("unit", [5, "m", "Hz", "", " "])
45+
def test_nontime_unit_return_nan(converter, unit):
4346
# Don't use == on np.nan. Floating point numbers are complicated!
44-
assert np.isnan(converter.unit_to_seconds(5))
45-
assert np.isnan(converter.unit_to_seconds("keV"))
46-
assert np.isnan(converter.unit_to_seconds(""))
47-
assert np.isnan(converter.unit_to_seconds(" "))
47+
assert np.isnan(converter.unit_to_seconds(unit))

0 commit comments

Comments
 (0)