summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_nanfunctions.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2016-08-31 21:22:17 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2016-09-02 10:10:55 +0200
commit514d13679a55a82a96689679002c4ddc514641ce (patch)
treebb1689ec8440879cbe9a4f60fc09beb0613a7352 /numpy/lib/tests/test_nanfunctions.py
parent20ea3a25119834c2224e32caebf4f2fb4966edd3 (diff)
downloadnumpy-514d13679a55a82a96689679002c4ddc514641ce.tar.gz
TST: Use ComplexWarning suppression only where needed
Diffstat (limited to 'numpy/lib/tests/test_nanfunctions.py')
-rw-r--r--numpy/lib/tests/test_nanfunctions.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/lib/tests/test_nanfunctions.py b/numpy/lib/tests/test_nanfunctions.py
index e4aea4482..06c0953b5 100644
--- a/numpy/lib/tests/test_nanfunctions.py
+++ b/numpy/lib/tests/test_nanfunctions.py
@@ -318,7 +318,9 @@ class SharedNanFunctionsTestsMixin(object):
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
for c in codes:
with suppress_warnings() as sup:
- sup.filter(np.ComplexWarning)
+ if nf in {np.nanstd, np.nanvar} and c in 'FDG':
+ # Giving the warning is a small bug, see gh-8000
+ sup.filter(np.ComplexWarning)
tgt = rf(mat, dtype=np.dtype(c), axis=1).dtype.type
res = nf(mat, dtype=np.dtype(c), axis=1).dtype.type
assert_(res is tgt)
@@ -333,7 +335,9 @@ class SharedNanFunctionsTestsMixin(object):
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
for c in codes:
with suppress_warnings() as sup:
- sup.filter(np.ComplexWarning)
+ if nf in {np.nanstd, np.nanvar} and c in 'FDG':
+ # Giving the warning is a small bug, see gh-8000
+ sup.filter(np.ComplexWarning)
tgt = rf(mat, dtype=c, axis=1).dtype.type
res = nf(mat, dtype=c, axis=1).dtype.type
assert_(res is tgt)