Skip to content

Commit 8f2ceed

Browse files
committed
check that integer units are properly converted to str
1 parent 1974e8a commit 8f2ceed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cf_xarray/tests/test_units.py

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ def test_percent_units():
5151
assert str(ureg("%").units) == "percent"
5252

5353

54+
def test_integer_units():
55+
"""Test that integer 1 units is equal to dimensionless"""
56+
# need to explicitly use parse_units to bypass the runtime type checking
57+
# in the quantity constructor
58+
assert str(ureg.parse_units(1)) == "dimensionless"
59+
60+
5461
@pytest.mark.xfail(reason="not supported by pint, yet: hgrecco/pint#1295")
5562
def test_udunits_power_syntax():
5663
"""Test that UDUNITS style powers are properly parsed and interpreted."""

0 commit comments

Comments
 (0)