diff options
author | Hernan Grecco <hernan.grecco@gmail.com> | 2023-04-29 10:15:43 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-29 10:15:43 -0300 |
commit | 1d65a3f34e5ec7dd2d62426cfb9e73c116bfe04e (patch) | |
tree | e2b3c235f31d7b3db89058cda5340a2b642ba941 /pint | |
parent | 9c7648c0bcc3d57f2ec4dde2e2df668e672b707e (diff) | |
parent | a283f0fdaad778ff153f2fc9c23d72341460465c (diff) | |
download | pint-1d65a3f34e5ec7dd2d62426cfb9e73c116bfe04e.tar.gz |
Merge pull request #1760 from jules-ch/test-all-close
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 550584f..1e0b928 100644 --- a/pint/testsuite/test_numpy.py +++ b/pint/testsuite/test_numpy.py @@ -1385,6 +1385,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 ) @@ -1394,6 +1397,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 |