Skip to content

Commit

Permalink
test: xfail is incorrect here
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Feb 15, 2025
1 parent 6a72c20 commit bdbd502
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pint/testsuite/test_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,27 +273,27 @@ def test_default_formatting(self, subtests):
ureg.formatter.default_format = spec
assert f"{x}" == result

@pytest.mark.xfail(reason="Still not clear how default formatting will work.")
def test_formatting_override_default_units(self):
ureg = UnitRegistry()
ureg.formatter.default_format = "~"
x = ureg.Quantity(4, "m ** 2")

assert f"{x:dP}" == "4 meter²"
ureg.separate_format_defaults = None
with pytest.warns(DeprecationWarning):
assert f"{x:d}" == "4 meter ** 2"

ureg.separate_format_defaults = True
with assert_no_warnings():
assert f"{x:d}" == "4 m ** 2"

@pytest.mark.xfail(reason="Still not clear how default formatting will work.")
def test_formatting_override_default_magnitude(self):
ureg = UnitRegistry()
ureg.formatter.default_format = ".2f"
x = ureg.Quantity(4, "m ** 2")

assert f"{x:dP}" == "4 meter²"
ureg.separate_format_defaults = None
with pytest.warns(DeprecationWarning):
assert f"{x:D}" == "4 meter ** 2"

Expand Down

0 comments on commit bdbd502

Please sign in to comment.