diff options
author | Jules Chéron <jules.cheron@gmail.com> | 2023-04-29 00:01:17 +0200 |
---|---|---|
committer | Jules Chéron <jules.cheron@gmail.com> | 2023-04-29 00:01:17 +0200 |
commit | a283f0fdaad778ff153f2fc9c23d72341460465c (patch) | |
tree | 06a4c6bed710eb9d87ab37ba64d76bc6642e03b8 /pint | |
parent | 1b54de47fcb3eeaf4c52e5acb519bd212216f413 (diff) | |
download | pint-a283f0fdaad778ff153f2fc9c23d72341460465c.tar.gz |
fix(test): Add tests for all close with nan and atol default
Diffstat (limited to 'pint')
-rw-r--r-- | pint/testsuite/test_numpy.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pint/testsuite/test_numpy.py b/pint/testsuite/test_numpy.py index 080c60a..f9f1095 100644 --- a/pint/testsuite/test_numpy.py +++ b/pint/testsuite/test_numpy.py @@ -1369,6 +1369,9 @@ class TestNumpyUnclassified(TestNumpyMethods): @helpers.requires_array_function_protocol() def test_allclose(self): assert np.allclose([1e10, 1e-8] * self.ureg.m, [1.00001e10, 1e-9] * self.ureg.m) + assert np.allclose( + [1e10, 1e-8] * self.ureg.m, [1.00001e13, 1e-6] * self.ureg.mm + ) assert not np.allclose( [1e10, 1e-8] * self.ureg.m, [1.00001e10, 1e-9] * self.ureg.mm ) @@ -1378,6 +1381,12 @@ class TestNumpyUnclassified(TestNumpyMethods): atol=1e-8 * self.ureg.m, ) + assert not np.allclose([1.0, np.nan] * self.ureg.m, [1.0, np.nan] * self.ureg.m) + + assert np.allclose( + [1.0, np.nan] * self.ureg.m, [1.0, np.nan] * self.ureg.m, equal_nan=True + ) + with pytest.raises(DimensionalityError): assert np.allclose( [1e10, 1e-8] * self.ureg.m, [1.00001e10, 1e-9] * self.ureg.m, atol=1e-8 |