diff options
author | Antti Kaihola <antti.kaihola@eniram.fi> | 2016-10-12 22:50:44 +0300 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-10-17 16:18:48 -0600 |
commit | 8077d85832ba45d24c62dcae0111b9320de1602c (patch) | |
tree | 43b02a71490f896b77014d5d15343681b56103f5 /numpy/testing/tests/test_utils.py | |
parent | 9569e504bd1363e2e9dba693a29d30ee3dd55056 (diff) | |
download | numpy-8077d85832ba45d24c62dcae0111b9320de1602c.tar.gz |
TST: Add tests for assert_allclose(..., equal_nan={True|False})
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index c191aea5b..5ca29d3c5 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -554,6 +554,18 @@ class TestAssertAllclose(unittest.TestCase): msg = exc.args[0] self.assertTrue("mismatch 25.0%" in msg) + def test_equal_nan(self): + a = np.array([np.nan]) + b = np.array([np.nan]) + # Should not raise: + assert_allclose(a, b, equal_nan=True) + + def test_not_equal_nan(self): + a = np.array([np.nan]) + b = np.array([np.nan]) + self.assertRaises(AssertionError, assert_allclose, a, b, + equal_nan=False) + class TestArrayAlmostEqualNulp(unittest.TestCase): |