10000 TST: Use ComplexWarning suppression only where needed · numpy/numpy@514d136 · GitHub
[go: up one dir, main page]

Skip to content

Commit 514d136

Browse files
committed
TST: Use ComplexWarning suppression only where needed
1 parent 20ea3a2 commit 514d136

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

numpy/lib/tests/test_nanfunctions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ def test_dtype_from_dtype(self):
318318
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
319319
for c in codes:
320320
with suppress_warnings() as sup:
321-
sup.filter(np.ComplexWarning)
321+
if nf in {np.nanstd, np.nanvar} and c in 'FDG':
322+
# Giving the warning is a small bug, see gh-8000
323+
sup.filter(np.ComplexWarning)
322324
tgt = rf(mat, dtype=np.dtype(c), axis=1).dtype.type
323325
res = nf(mat, dtype=np.dtype(c), axis=1).dtype.type
324326
assert_(res is tgt)
@@ -333,7 +335,9 @@ def test_dtype_from_char(self):
333335
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
334336
for c in codes:
335337
with suppress_warnings() as sup:
336-
sup.filter(np.ComplexWarning)
338+
if nf in {np.nanstd, np.nanvar} and c in 'FDG':
339+
# Giving the warning is a small bug, see gh-8000
340+
sup.filter(np.ComplexWarning)
337341
tgt = rf(mat, dtype=c, axis=1).dtype.type
338342
res = nf(mat, dtype=c, axis=1).dtype.type
339343
assert_(res is tgt)

0 commit comments

Comments
 (0)
0