diff options
author | David Cournapeau <cournape@gmail.com> | 2009-07-28 05:52:36 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-07-28 05:52:36 +0000 |
commit | 3feb77ee4e46962b6c9cfab2a37a0c1ef1ceda82 (patch) | |
tree | f57893dc010d8037213951925c44cbb39427dc50 /numpy/testing/tests | |
parent | 5b2699cf291a8f5f8fd90a9b910937cad0e8d043 (diff) | |
download | numpy-3feb77ee4e46962b6c9cfab2a37a0c1ef1ceda82.tar.gz |
BUG: fix nan/inf handling for complex dtypes.
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 240752dcf..448a2e3e7 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -206,6 +206,21 @@ class TestAlmostEqual(_GenericTest, unittest.TestCase): def test_simple_item(self): self._test_not_equal(1, 2) + def test_complex_item(self): + self._assert_func(complex(1, 2), complex(1, 2)) + self._assert_func(complex(1, np.nan), complex(1, np.nan)) + self._test_not_equal(complex(1, np.nan), complex(1, 2)) + self._test_not_equal(complex(np.nan, 1), complex(1, np.nan)) + self._test_not_equal(complex(np.nan, np.inf), complex(np.nan, 2)) + + def test_complex(self): + x = np.array([complex(1, 2), complex(1, np.nan)]) + z = np.array([complex(1, 2), complex(np.nan, 1)]) + y = np.array([complex(1, 2), complex(1, 2)]) + self._assert_func(x, x) + self._test_not_equal(x, y) + self._test_not_equal(x, z) + class TestApproxEqual(unittest.TestCase): def setUp(self): self._assert_func = assert_approx_equal |