Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a84b8d3

Browse filesBrowse files
authored
Merge pull request #12340 from dstansby/demean-warnings
TST: Catch test deprecation warnings for mlab.demean
2 parents 97cad3d + a7b1c31 commit a84b8d3
Copy full SHA for a84b8d3

File tree

Expand file treeCollapse file tree

1 file changed

+18
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-9
lines changed

‎lib/matplotlib/tests/test_mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_mlab.py
+18-9Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -721,25 +721,29 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self):
721721
def test_demean_0D_off(self):
722722
input = 5.5
723723
targ = 0.
724-
res = mlab.demean(input, axis=None)
724+
with pytest.warns(MatplotlibDeprecationWarning):
725+
res = mlab.demean(input, axis=None)
725726
assert_almost_equal(res, targ)
726727

727728
def test_demean_1D_base_slope_off(self):
728729
input = self.sig_base + self.sig_slope + self.sig_off
729730
targ = self.sig_base + self.sig_slope_mean
730-
res = mlab.demean(input)
731+
with pytest.warns(MatplotlibDeprecationWarning):
732+
res = mlab.demean(input)
731733
assert_allclose(res, targ, atol=1e-08)
732734

733735
def test_demean_1D_base_slope_off_axis0(self):
734736
input = self.sig_base + self.sig_slope + self.sig_off
735737
targ = self.sig_base + self.sig_slope_mean
736-
res = mlab.demean(input, axis=0)
738+
with pytest.warns(MatplotlibDeprecationWarning):
739+
res = mlab.demean(input, axis=0)
737740
assert_allclose(res, targ, atol=1e-08)
738741

739742
def test_demean_1D_base_slope_off_list(self):
740743
input = self.sig_base + self.sig_slope + self.sig_off
741744
targ = self.sig_base + self.sig_slope_mean
742-
res = mlab.demean(input.tolist())
745+
with pytest.warns(MatplotlibDeprecationWarning):
746+
res = mlab.demean(input.tolist())
743747
assert_allclose(res, targ, atol=1e-08)
744748

745749
def test_detrend_mean_2D_default(self):
@@ -906,7 +910,8 @@ def test_demean_2D_default(self):
906910
self.sig_base + self.sig_slope_mean]
907911
input = np.vstack(arri).T
908912
targ = np.vstack(arrt).T
909-
res = mlab.demean(input)
913+
with pytest.warns(MatplotlibDeprecationWarning):
914+
res = mlab.demean(input)
910915
assert_allclose(res, targ,
911916
atol=1e-08)
912917

@@ -917,7 +922,8 @@ def test_demean_2D_none(self):
917922
self.sig_base]
918923
input = np.vstack(arri)
919924
targ = np.vstack(arrt)
920-
res = mlab.demean(input, axis=None)
925+
with pytest.warns(MatplotlibDeprecationWarning):
926+
res = mlab.demean(input, axis=None)
921927
assert_allclose(res, targ,
922928
atol=1e-08)
923929

@@ -932,7 +938,8 @@ def test_demean_2D_axis0(self):
932938
self.sig_base + self.sig_slope_mean]
933939
input = np.vstack(arri).T
934940
targ = np.vstack(arrt).T
935-
res = mlab.demean(input, axis=0)
941+
with pytest.warns(MatplotlibDeprecationWarning):
942+
res = mlab.demean(input, axis=0)
936943
assert_allclose(res, targ,
937944
atol=1e-08)
938945

@@ -947,7 +954,8 @@ def test_demean_2D_axis1(self):
947954
self.sig_base + self.sig_slope_mean]
948955
input = np.vstack(arri)
949956
targ = np.vstack(arrt)
950-
res = mlab.demean(input, axis=1)
957+
with pytest.warns(MatplotlibDeprecationWarning):
958+
res = mlab.demean(input, axis=1)
951959
assert_allclose(res, targ,
952960
atol=1e-08)
953961

@@ -962,7 +970,8 @@ def test_demean_2D_axism1(self):
962970
self.sig_base + self.sig_slope_mean]
963971
input = np.vstack(arri)
964972
targ = np.vstack(arrt)
965-
res = mlab.demean(input, axis=-1)
973+
with pytest.warns(MatplotlibDeprecationWarning):
974+
res = mlab.demean(input, axis=-1)
966975
assert_allclose(res, targ,
967976
atol=1e-08)
968977

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.