Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4965500

Browse files
authored
Merge pull request#24113 from QuLogic/warn-types
Add exception class to pytest.warns calls
2 parents6f137b9 +529d26f commit4965500

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

‎lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,15 @@ def test_subclass_clear_cla():
491491
# Note, we cannot use mocking here as we want to be sure that the
492492
# superclass fallback does not recurse.
493493

494-
withpytest.warns(match='Overriding `Axes.cla`'):
494+
withpytest.warns(PendingDeprecationWarning,
495+
match='Overriding `Axes.cla`'):
495496
classClaAxes(Axes):
496497
defcla(self):
497498
nonlocalcalled
498499
called=True
499500

500-
withpytest.warns(match='Overriding `Axes.cla`'):
501+
withpytest.warns(PendingDeprecationWarning,
502+
match='Overriding `Axes.cla`'):
501503
classClaSuperAxes(Axes):
502504
defcla(self):
503505
nonlocalcalled

‎lib/matplotlib/tests/test_colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_double_register_builtin_cmap():
117117
mpl.colormaps[name],name=name,force=True
118118
)
119119
withpytest.raises(ValueError,match='A colormap named "viridis"'):
120-
withpytest.warns():
120+
withpytest.warns(PendingDeprecationWarning):
121121
cm.register_cmap(name,mpl.colormaps[name])
122122
withpytest.warns(UserWarning):
123123
# TODO is warning more than once!
@@ -128,7 +128,7 @@ def test_unregister_builtin_cmap():
128128
name="viridis"
129129
match=f'cannot unregister{name!r} which is a builtin colormap.'
130130
withpytest.raises(ValueError,match=match):
131-
withpytest.warns():
131+
withpytest.warns(PendingDeprecationWarning):
132132
cm.unregister_cmap(name)
133133

134134

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp