Skip to content

Commit

Permalink
TST: add a test case for bug 473
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Nov 11, 2023
1 parent bd00dee commit 99cf350
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions unyt/tests/test_unit_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ def test_modify_symbol_from_default_unit_registry():
default_unit_registry.remove("cm")


def test_modify_cache_clear():
# see https://github.com/yt-project/unyt/issues/473

ureg = UnitRegistry()
ureg.add("celery", 1.0, length)
u0 = Unit("m", registry=ureg)
Unit("celery", registry=ureg)

ureg.modify("celery", 0.5)
u2 = Unit("celery", registry=ureg)
assert 1.0 * u2 == 0.5 * u0

# TODO: test behaviour in u1 pre/post modification


def test_keys():
ureg = UnitRegistry()
assert sorted(ureg.keys()) == sorted(ureg.lut.keys())
Expand Down

0 comments on commit 99cf350

Please sign in to comment.