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

Skip to content

Commit edffd3c

Browse files
committed
Use assert_array_almost_equal from numpy.ma
This does not raise warnings about NaNs in the masked part of the array.
1 parent 58ac6a8 commit edffd3c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/tests/test_triangulation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from nose.tools import assert_equal, assert_raises
1010
from numpy.testing import assert_array_equal, assert_array_almost_equal,\
1111
assert_array_less
12+
import numpy.ma.testutils as matest
1213
from matplotlib.testing.decorators import image_comparison
1314
import matplotlib.cm as cm
1415
from matplotlib.path import Path
@@ -323,7 +324,7 @@ def test_triinterp():
323324
xs, ys = np.meshgrid(xs, ys)
324325
for interp in (linear_interp, cubic_min_E, cubic_geom):
325326
zs = interp(xs, ys)
326-
assert_array_almost_equal(zs, (1.23*xs - 4.79*ys))
327+
matest.assert_array_almost_equal(zs, (1.23*xs - 4.79*ys))
327328
mask = (xs >= 1) * (xs <= 2) * (ys >= 1) * (ys <= 2)
328329
assert_array_equal(zs.mask, mask)
329330

@@ -697,7 +698,8 @@ def z(x, y):
697698
interp_z0[interp_key] = interp(xs0, ys0) # storage
698699
else:
699700
interpz = interp(xs, ys)
700-
assert_array_almost_equal(interpz, interp_z0[interp_key])
701+
matest.assert_array_almost_equal(interpz,
702+
interp_z0[interp_key])
701703

702704
scale_factor = 987654.3210
703705
for scaled_axis in ('x', 'y'):
@@ -723,7 +725,7 @@ def z(x, y):
723725
# 1 axis...
724726
for interp_key in ['lin', 'min_E', 'geom']:
725727
interpz = dic_interp[interp_key](xs, ys)
726-
assert_array_almost_equal(interpz, interp_z0[interp_key])
728+
matest.assert_array_almost_equal(interpz, interp_z0[interp_key])
727729

728730

729731
@image_comparison(baseline_images=['tri_smooth_contouring'],

0 commit comments

Comments
 (0)