Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19298c9

Browse files
committed
Add test for annotation parameter name change warning
Flake8 Match warning to ensure correct one caught, Update version deprecated Flake8 whitespace Simplify test
1 parent e39e3cf commit 19298c9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def text(self, x, y, s, fontdict=None, **kwargs):
753753
self._add_text(t)
754754
return t
755755

756-
@cbook._rename_parameter("3.2", "s", "text")
756+
@cbook._rename_parameter("3.3", "s", "text")
757757
@docstring.dedent_interpd
758758
def annotate(self, text, xy, *args, **kwargs):
759759
a = mtext.Annotation(text, xy, *args, **kwargs)

lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,14 @@ def test_basic_annotate():
435435
xytext=(3, 3), textcoords='offset points')
436436

437437

438+
def test_annotate_parameter_warn():
439+
fig, ax = plt.subplots()
440+
with pytest.warns(MatplotlibDeprecationWarning,
441+
match=r"The \'s\' parameter of annotate\(\) "
442+
"has been renamed \'text\'"):
443+
ax.annotate(s='now named text', xy=(0, 1))
444+
445+
438446
@image_comparison(['arrow_simple.png'], remove_text=True)
439447
def test_arrow_simple():
440448
# Simple image test for ax.arrow

0 commit comments

Comments
 (0)