diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2014-09-04 16:44:59 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-09-04 16:44:59 -0600 |
commit | 77703de7a14c66dcba6ee89bdd7b084ba70f056c (patch) | |
tree | 4b445a84607257f626704e3e5202be7f4e97110d /numpy/testing/tests | |
parent | 3ab6ec8e16906fc471f3c49400c62ce0857d5404 (diff) | |
parent | dfc567790badcc87822a39f5c35f0dd78b8c1599 (diff) | |
download | numpy-77703de7a14c66dcba6ee89bdd7b084ba70f056c.tar.gz |
Merge pull request #5048 from juliantaylor/subclass-test-fix
BUG: fix array_almost_equal for array subclasses
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 5189f7e63..34608125d 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -244,6 +244,14 @@ class TestArrayAlmostEqual(_GenericTest, unittest.TestCase): self.assertRaises(AssertionError, lambda : self._assert_func(a, b)) + def test_subclass(self): + a = np.array([[1., 2.], [3., 4.]]) + b = np.ma.masked_array([[1., 2.], [0., 4.]], + [[False, False], [True, False]]) + assert_array_almost_equal(a, b) + assert_array_almost_equal(b, a) + assert_array_almost_equal(b, b) + class TestAlmostEqual(_GenericTest, unittest.TestCase): def setUp(self): self._assert_func = assert_almost_equal |