Skip to content

Catch test deprecation warnings for mlab.demean #12340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions lib/matplotlib/tests/test_mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,25 +721,29 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self):
def test_demean_0D_off(self):
input = 5.5
targ = 0.
res = mlab.demean(input, axis=None)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=None)
assert_almost_equal(res, targ)

def test_demean_1D_base_slope_off(self):
input = self.sig_base + self.sig_slope + self.sig_off
targ = self.sig_base + self.sig_slope_mean
res = mlab.demean(input)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input)
assert_allclose(res, targ, atol=1e-08)

def test_demean_1D_base_slope_off_axis0(self):
input = self.sig_base + self.sig_slope + self.sig_off
targ = self.sig_base + self.sig_slope_mean
res = mlab.demean(input, axis=0)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=0)
assert_allclose(res, targ, atol=1e-08)

def test_demean_1D_base_slope_off_list(self):
input = self.sig_base + self.sig_slope + self.sig_off
targ = self.sig_base + self.sig_slope_mean
res = mlab.demean(input.tolist())
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input.tolist())
assert_allclose(res, targ, atol=1e-08)

def test_detrend_mean_2D_default(self):
Expand Down Expand Up @@ -906,7 +910,8 @@ def test_demean_2D_default(self):
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri).T
targ = np.vstack(arrt).T
res = mlab.demean(input)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input)
assert_allclose(res, targ,
atol=1e-08)

Expand All @@ -917,7 +922,8 @@ def test_demean_2D_none(self):
self.sig_base]
input = np.vstack(arri)
targ = np.vstack(arrt)
res = mlab.demean(input, axis=None)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=None)
assert_allclose(res, targ,
atol=1e-08)

Expand All @@ -932,7 +938,8 @@ def test_demean_2D_axis0(self):
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri).T
targ = np.vstack(arrt).T
res = mlab.demean(input, axis=0)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=0)
assert_allclose(res, targ,
atol=1e-08)

Expand All @@ -947,7 +954,8 @@ def test_demean_2D_axis1(self):
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri)
targ = np.vstack(arrt)
res = mlab.demean(input, axis=1)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=1)
assert_allclose(res, targ,
atol=1e-08)

Expand All @@ -962,7 +970,8 @@ def test_demean_2D_axism1(self):
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri)
targ = np.vstack(arrt)
res = mlab.demean(input, axis=-1)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=-1)
assert_allclose(res, targ,
atol=1e-08)

Expand Down