From 8077d85832ba45d24c62dcae0111b9320de1602c Mon Sep 17 00:00:00 2001 From: Antti Kaihola Date: Wed, 12 Oct 2016 22:50:44 +0300 Subject: TST: Add tests for assert_allclose(..., equal_nan={True|False}) --- numpy/testing/tests/test_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'numpy/testing') 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): -- cgit v1.2.1