@@ -1711,3 +1711,63 @@ def test_view_init_vertical_axis(
1711
1711
tickdir_expected = tickdirs_expected [i ]
1712
1712
tickdir_actual = axis ._get_tickdir ()
1713
1713
np .testing .assert_array_equal (tickdir_expected , tickdir_actual )
1714
+
1715
+
1716
+ def test_do_3d_projection_renderer_deprecation_warn_on_argument ():
1717
+ """
1718
+ Test that an external artist with an old-style calling convention raises
1719
+ a suitable deprecation warning.
1720
+ """
1721
+ class DummyPatch (art3d .Patch3D ):
1722
+ def do_3d_projection (self , renderer ):
1723
+ return 0
1724
+
1725
+ def draw (self , renderer ):
1726
+ pass
1727
+
1728
+ fig = plt .figure ()
1729
+ ax = fig .add_subplot (111 , projection = '3d' )
1730
+ artist = DummyPatch ()
1731
+ ax .add_artist (artist )
1732
+
1733
+ match = r"The 'renderer' parameter of do_3d_projection\(\) was deprecated"
1734
+ with pytest .warns (MatplotlibDeprecationWarning , match = match ):
1735
+ fig .canvas .draw ()
1736
+
1737
+
1738
+ def test_do_3d_projection_renderer_deprecation_nowarn_on_optional_argument ():
1739
+ """
1740
+ Test that an external artist with a calling convention compatible with
1741
+ both v3.3 and v3.4 does not raise a deprecation warning.
1742
+ """
1743
+ class DummyPatch (art3d .Patch3D ):
1744
+ def do_3d_projection (self , renderer = None ):
1745
+ return 0
1746
+
1747
+ def draw (self , renderer ):
1748
+ pass
1749
+
1750
+ fig = plt .figure ()
1751
+ ax = fig .add_subplot (111 , projection = '3d' )
1752
+ artist = DummyPatch ()
1753
+ ax .add_artist (artist )
1754
+ fig .canvas .draw ()
1755
+
1756
+
1757
+ def test_do_3d_projection_renderer_deprecation_nowarn_on_no_argument ():
1758
+ """
1759
+ Test that an external artist with a calling convention compatible with
1760
+ only v3.4 does not raise a deprecation warning.
1761
+ """
1762
+ class DummyPatch (art3d .Patch3D ):
1763
+ def do_3d_projection (self ):
1764
+ return 0
1765
+
1766
+ def draw (self , renderer ):
1767
+ pass
1768
+
1769
+ fig = plt .figure ()
1770
+ ax = fig .add_subplot (111 , projection = '3d' )
1771
+ artist = DummyPatch ()
1772
+ ax .add_artist (artist )
1773
+ fig .canvas .draw ()
0 commit comments