From 2635e13df69175f01a4a5c2f57a83a2a6edadefd Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 4 Aug 2023 13:47:29 -0500 Subject: [PATCH] Remove soon to be deprecated nan/inf aliases --- lib/matplotlib/tests/test_axes.py | 6 +++--- lib/matplotlib/tests/test_colors.py | 6 +++--- lib/matplotlib/tests/test_image.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 24d5f6768b64..6c970cdbeb3c 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1479,7 +1479,7 @@ def test_pcolorargs(): ax.pcolormesh(x, y, Z[:-1, :-1], shading="gouraud") with pytest.raises(TypeError): ax.pcolormesh(X, Y, Z[:-1, :-1], shading="gouraud") - x[0] = np.NaN + x[0] = np.nan with pytest.raises(ValueError): ax.pcolormesh(x, y, Z[:-1, :-1]) with np.errstate(invalid='ignore'): @@ -7411,7 +7411,7 @@ def test_limits_after_scroll_zoom(): def test_gettightbbox_ignore_nan(): fig, ax = plt.subplots() remove_ticks_and_titles(fig) - ax.text(np.NaN, 1, 'Boo') + ax.text(np.nan, 1, 'Boo') renderer = fig.canvas.get_renderer() np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 496) @@ -8591,7 +8591,7 @@ def test_bar_leading_nan(): barheights = np.array([0.5, 1.5, 2.0]) barstarts = np.array([0.77]*3) - barx[0] = np.NaN + barx[0] = np.nan fig, ax = plt.subplots() diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 32af4a469f1c..e8fc9baa1479 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -339,7 +339,7 @@ def test_BoundaryNorm(): # Masked arrays boundaries = [0, 1.1, 2.2] - vals = np.ma.masked_invalid([-1., np.NaN, 0, 1.4, 9]) + vals = np.ma.masked_invalid([-1., np.nan, 0, 1.4, 9]) # Without interpolation ncolors = len(boundaries) - 1 @@ -353,9 +353,9 @@ def test_BoundaryNorm(): assert_array_equal(bn(vals), expected) # Non-trivial masked arrays - vals = np.ma.masked_invalid([np.Inf, np.NaN]) + vals = np.ma.masked_invalid([np.inf, np.nan]) assert np.all(bn(vals).mask) - vals = np.ma.masked_invalid([np.Inf]) + vals = np.ma.masked_invalid([np.inf]) assert np.all(bn(vals).mask) # Incompatible extend and clip diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index a6b37bfb3102..aeeebd136b65 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -1376,7 +1376,7 @@ def test_rgba_antialias(): aa[:, int(N/2):] = a[:, int(N/2):] # set some over/unders and NaNs - aa[20:50, 20:50] = np.NaN + aa[20:50, 20:50] = np.nan aa[70:90, 70:90] = 1e6 aa[70:90, 20:30] = -1e6 aa[70:90, 195:215] = 1e6