Fix operations with measurments and user defined units.

Close #204
This commit is contained in:
Hernan Grecco
2014-11-07 20:35:01 -03:00
parent 71d40b9048
commit d682a21f19

View File

@@ -49,6 +49,8 @@ def _check(q1, other):
# Both quantities are the same class and therefore from the same registry.
# (Each registry has its own Quantity class)
return True
elif q1._REGISTRY is getattr(other, '_REGISTRY', None):
return True
elif isinstance(other, _Quantity):
# The other object is a Quantity but from another registry.
raise ValueError('Cannot operate between quantities of different registries')