Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 827393e

Browse files
committed
Use ma.testutils rather than a filter for warnings with NaN in
masked arrays in test_mlab
1 parent edffd3c commit 827393e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/matplotlib/tests/test_mlab.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import tempfile
77

88
from numpy.testing import assert_allclose, assert_array_equal
9+
import numpy.ma.testutils as matest
910
import numpy as np
1011
from nose.tools import (assert_equal, assert_almost_equal, assert_not_equal,
1112
assert_true, assert_raises)
@@ -2714,10 +2715,7 @@ def get_z(x, y):
27142715
z_masked = np.ma.array(z, mask=[False, False, False, True, False])
27152716
correct_zi_masked = np.ma.masked_where(xi + yi > 1.0, get_z(xi, yi))
27162717
zi = mlab.griddata(x, y, z_masked, xi, yi, interp='linear')
2717-
with np.errstate(invalid='ignore'):
2718-
# The array contains a number of NaNs so suppress the
2719-
# numpy warnings here.
2720-
np.testing.assert_array_almost_equal(zi, correct_zi_masked)
2718+
matest.assert_array_almost_equal(zi, correct_zi_masked)
27212719
np.testing.assert_array_equal(np.ma.getmask(zi),
27222720
np.ma.getmask(correct_zi_masked))
27232721

0 commit comments

Comments
 (0)