-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: fix caching error with UnitRegistry.modify #476
BUG: fix caching error with UnitRegistry.modify #476
Conversation
5bf52c5
to
99cf350
Compare
2aee0fc
to
d8b8e91
Compare
unyt/tests/test_unit_registry.py
Outdated
u2 = Unit("celery", registry=ureg) | ||
assert 1.0 * u2 == 0.5 * u0 | ||
|
||
# TODO: test behaviour in u1 pre/post modification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line refers to the Unit created on after u0 (I guess linters removed the variable binding to u1
because I didn't use it). The behaviour I'm getting with the branch at the moment is that the Unit object created before ureg.modify
still uses the original base value even after modification of the registry. This seems to be in line with @AdamCohan's expectations, and seems consistent with the idea that Unit
objects should be immutable, but I don't think that this case is currently tested. @jzuhone, what should be the expected behaviour in your opinion ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try that again: @jzuhone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior you are seeing is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you ! I've updated the test to reflect this and rebased the branch, this is now ready for review !
24c7864
to
0f62901
Compare
close #473