|
31 | 31 | from numpy.testing import ( |
32 | 32 | assert_allclose, assert_array_equal, assert_array_almost_equal) |
33 | 33 | from matplotlib import rc_context |
34 | | -from matplotlib.cbook import MatplotlibDeprecationWarning |
| 34 | +from matplotlib._api import MatplotlibDeprecationWarning |
35 | 35 |
|
36 | 36 | # Note: Some test cases are run twice: once normally and once with labeled data |
37 | 37 | # These two must be defined in the same test function or need to have |
@@ -591,24 +591,27 @@ def test_arrow_simple(): |
591 | 591 | (length_includes_head, shape, head_starts_at_zero) = kwarg |
592 | 592 | theta = 2 * np.pi * i / 12 |
593 | 593 | # 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) |
601 | 602 |
|
602 | 603 |
|
603 | 604 | def test_arrow_empty(): |
604 | 605 | _, ax = plt.subplots() |
605 | 606 | # 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) |
607 | 609 |
|
608 | 610 |
|
609 | 611 | def test_arrow_in_view(): |
610 | 612 | _, ax = plt.subplots() |
611 | | - ax.arrow(1, 1, 1, 1) |
| 613 | + with pytest.warns(MatplotlibDeprecationWarning): |
| 614 | + ax.arrow(1, 1, 1, 1) |
612 | 615 | assert ax.get_xlim() == (0.8, 2.2) |
613 | 616 | assert ax.get_ylim() == (0.8, 2.2) |
614 | 617 |
|
|
0 commit comments