diff options
author | Lewis A. Marshall <lewis@purigenbio.com> | 2020-10-31 11:00:28 -0700 |
---|---|---|
committer | Lewis A. Marshall <lewis@purigenbio.com> | 2020-10-31 11:00:28 -0700 |
commit | 79dc97e652d67f4a9eae4b8be6590374a32edd17 (patch) | |
tree | 4191253d3d6277de2ae6985d788693b517437b17 /pint/testsuite/test_quantity.py | |
parent | 5e59f373ea237a95f22960a2b169c3a756a264c9 (diff) | |
download | pint-79dc97e652d67f4a9eae4b8be6590374a32edd17.tar.gz |
Quantity comparisons ensure other is Quantity.
Diffstat (limited to 'pint/testsuite/test_quantity.py')
-rw-r--r-- | pint/testsuite/test_quantity.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py index b5780e5..fe86801 100644 --- a/pint/testsuite/test_quantity.py +++ b/pint/testsuite/test_quantity.py @@ -6,7 +6,7 @@ import pickle import warnings from unittest.mock import patch -from pint import DimensionalityError, OffsetUnitCalculusError, UnitRegistry +from pint import DimensionalityError, OffsetUnitCalculusError, UnitRegistry, Quantity, get_application_registry from pint.compat import np from pint.testsuite import QuantityTestCase, helpers from pint.testsuite.parameterized import ParameterizedTestCase @@ -63,6 +63,8 @@ class TestQuantity(QuantityTestCase): y = self.Q_(4.2, "meter") z = self.Q_(5, "meter") j = self.Q_(5, "meter*meter") + k = 5 * get_application_registry().meter # Include a comparison to the application registry + l = Quantity(5, "meter") # Include a comparison to a directly created Quantity # identity for single object self.assertTrue(x == x) @@ -81,6 +83,11 @@ class TestQuantity(QuantityTestCase): self.assertTrue(x != z) self.assertTrue(x < z) + # Compare with items to the separate application registry + self.assertTrue(k >= l) # These should both be from application registry + with self.assertRaises(ValueError): + z>l # One from local registry, one from application registry + self.assertTrue(z != j) self.assertNotEqual(z, j) |