summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-05-21 20:24:47 -0600
committerGitHub <noreply@github.com>2018-05-21 20:24:47 -0600
commitb08ce1ad3705b1cfbdb89b3be50c1756c74982c3 (patch)
tree9c7cc70ecdc9fb0b479be18a1da1598fc807e199 /numpy/testing/tests/test_utils.py
parent15f19c4058978ec30721d1295e093e4f53c5a6b9 (diff)
parente3f6bf79abcbda070556a8a524080c48be48f3a4 (diff)
downloadnumpy-b08ce1ad3705b1cfbdb89b3be50c1756c74982c3.tar.gz
Merge pull request #11124 from mhvk/assert-fully-masked-array
BUG: Ensure that fully masked arrays pass assert_array_equal.
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r--numpy/testing/tests/test_utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index c9e8384c2..602cdf5f2 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -366,6 +366,24 @@ class TestArrayAlmostEqual(_GenericTest):
self._assert_func(b, a)
self._assert_func(b, b)
+ # Test fully masked as well (see gh-11123).
+ a = np.ma.MaskedArray(3.5, mask=True)
+ b = np.array([3., 4., 6.5])
+ self._test_equal(a, b)
+ self._test_equal(b, a)
+ a = np.ma.masked
+ b = np.array([3., 4., 6.5])
+ self._test_equal(a, b)
+ self._test_equal(b, a)
+ a = np.ma.MaskedArray([3., 4., 6.5], mask=[True, True, True])
+ b = np.array([1., 2., 3.])
+ self._test_equal(a, b)
+ self._test_equal(b, a)
+ a = np.ma.MaskedArray([3., 4., 6.5], mask=[True, True, True])
+ b = np.array(1.)
+ self._test_equal(a, b)
+ self._test_equal(b, a)
+
def test_subclass_that_cannot_be_bool(self):
# While we cannot guarantee testing functions will always work for
# subclasses, the tests should ideally rely only on subclasses having