summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/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/_private/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/_private/utils.py')
-rw-r--r--numpy/testing/_private/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py
index b0c0b0c48..c420e1fb5 100644
--- a/numpy/testing/_private/utils.py
+++ b/numpy/testing/_private/utils.py
@@ -771,7 +771,11 @@ def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
reduced = val.ravel()
cond = reduced.all()
reduced = reduced.tolist()
- if not cond:
+ # The below comparison is a hack to ensure that fully masked
+ # results, for which val.ravel().all() returns np.ma.masked,
+ # do not trigger a failure (np.ma.masked != True evaluates as
+ # np.ma.masked, which is falsy).
+ if cond != True:
match = 100-100.0*reduced.count(1)/len(reduced)
msg = build_err_msg([x, y],
err_msg