Skip to content

Commit 6a66d30

Browse files
committed
Add tests for delete_parameter.
1 parent e12f16a commit 6a66d30

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/matplotlib/tests/test_cbook.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,28 @@ def test_safe_first_element_pandas_series(pd):
574574
assert actual == 0
575575

576576

577+
def test_delete_parameter():
578+
@cbook._delete_parameter("3.0", "foo")
579+
def func1(foo=None):
580+
pass
581+
582+
@cbook._delete_parameter("3.0", "foo")
583+
def func2(**kwargs):
584+
pass
585+
586+
for func in [func1, func2]:
587+
func() # No warning.
588+
with pytest.warns(MatplotlibDeprecationWarning):
589+
func(foo="bar")
590+
591+
def pyplot_wrapper(foo=cbook.deprecation._deprecated_parameter):
592+
func1(foo)
593+
594+
pyplot_wrapper() # No warning.
595+
with pytest.warns(MatplotlibDeprecationWarning):
596+
func(foo="bar")
597+
598+
577599
def test_make_keyword_only():
578600
@cbook._make_keyword_only("3.0", "arg")
579601
def func(pre, arg, post=None):

0 commit comments

Comments
 (0)