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

Skip to content

Commit 1b7856e

Browse files
committed
Suppress warning due to NaNs in this test.
1 parent 57040ac commit 1b7856e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/tests/test_mlab.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,10 @@ def get_z(x, y):
27142714
z_masked = np.ma.array(z, mask=[False, False, False, True, False])
27152715
correct_zi_masked = np.ma.masked_where(xi + yi > 1.0, get_z(xi, yi))
27162716
zi = mlab.griddata(x, y, z_masked, xi, yi, interp='linear')
2717-
np.testing.assert_array_almost_equal(zi, correct_zi_masked)
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)
27182721
np.testing.assert_array_equal(np.ma.getmask(zi),
27192722
np.ma.getmask(correct_zi_masked))
27202723

0 commit comments

Comments
 (0)