Skip to content

Commit 348d1d0

Browse files
committed
MNT: deprecate arrow
1 parent dc135e7 commit 348d1d0

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from numpy.testing import (
3232
assert_allclose, assert_array_equal, assert_array_almost_equal)
3333
from matplotlib import rc_context
34-
from matplotlib.cbook import MatplotlibDeprecationWarning
34+
from matplotlib._api import MatplotlibDeprecationWarning
3535

3636
# Note: Some test cases are run twice: once normally and once with labeled data
3737
# These two must be defined in the same test function or need to have
@@ -591,24 +591,27 @@ def test_arrow_simple():
591591
(length_includes_head, shape, head_starts_at_zero) = kwarg
592592
theta = 2 * np.pi * i / 12
593593
# Draw arrow
594-
ax.arrow(0, 0, np.sin(theta), np.cos(theta),
595-
width=theta/100,
596-
length_includes_head=length_includes_head,
597-
shape=shape,
598-
head_starts_at_zero=head_starts_at_zero,
599-
head_width=theta / 10,
600-
head_length=theta / 10)
594+
with pytest.warns(MatplotlibDeprecationWarning):
595+
ax.arrow(0, 0, np.sin(theta), np.cos(theta),
596+
width=theta/100,
597+
length_includes_head=length_includes_head,
598+
shape=shape,
599+
head_starts_at_zero=head_starts_at_zero,
600+
head_width=theta / 10,
601+
head_length=theta / 10)
601602

602603

603604
def test_arrow_empty():
604605
_, ax = plt.subplots()
605606
# Create an empty FancyArrow
606-
ax.arrow(0, 0, 0, 0, head_length=0)
607+
with pytest.warns(MatplotlibDeprecationWarning):
608+
ax.arrow(0, 0, 0, 0, head_length=0)
607609

608610

609611
def test_arrow_in_view():
610612
_, ax = plt.subplots()
611-
ax.arrow(1, 1, 1, 1)
613+
with pytest.warns(MatplotlibDeprecationWarning):
614+
ax.arrow(1, 1, 1, 1)
612615
assert ax.get_xlim() == (0.8, 2.2)
613616
assert ax.get_ylim() == (0.8, 2.2)
614617

lib/matplotlib/tests/test_patches.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from matplotlib import (
1515
collections as mcollections, colors as mcolors, patches as mpatches,
1616
path as mpath, transforms as mtransforms, rcParams)
17+
from matplotlib._api import MatplotlibDeprecationWarning
1718

1819
import sys
1920
on_win = (sys.platform == 'win32')
@@ -604,7 +605,8 @@ def test_fancyarrow_units():
604605

605606
def test_fancyarrow_setdata():
606607
fig, ax = plt.subplots()
607-
arrow = ax.arrow(0, 0, 10, 10, head_length=5, head_width=1, width=.5)
608+
with pytest.warns(MatplotlibDeprecationWarning):
609+
arrow = ax.arrow(0, 0, 10, 10, head_length=5, head_width=1, width=.5)
608610
expected1 = np.array(
609611
[[13.54, 13.54],
610612
[10.35, 9.65],

0 commit comments

Comments
 (0)