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

Skip to content

Commit 8d10261

Browse files
committed
TST: remove (or test) deprecated Axes3D behavior in tests
1 parent 668cecc commit 8d10261

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/matplotlib/tests/test_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def test_polycollection_close():
391391
[[3., 0.], [3., 1.], [4., 1.], [4., 0.]]]
392392

393393
fig = plt.figure()
394-
ax = fig.add_axes(Axes3D(fig))
394+
ax = fig.add_axes(Axes3D(fig, auto_add_to_figure=False))
395395

396396
colors = ['r', 'g', 'b', 'y', 'k']
397397
zpos = list(range(5))

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d, art3d
77
import matplotlib as mpl
88
from matplotlib.backend_bases import MouseButton
9+
from matplotlib.cbook import MatplotlibDeprecationWarning
910
from matplotlib import cm
1011
from matplotlib import colors as mcolors
1112
from matplotlib.testing.decorators import image_comparison, check_figures_equal
1213
from matplotlib.testing.widgets import mock_event
1314
from matplotlib.collections import LineCollection, PolyCollection
1415
from matplotlib.patches import Circle
16+
1517
import matplotlib.pyplot as plt
1618
import numpy as np
1719

@@ -725,7 +727,7 @@ def test_add_collection3d_zs_scalar():
725727
@mpl3d_image_comparison(['axes3d_labelpad.png'], remove_text=False)
726728
def test_axes3d_labelpad():
727729
fig = plt.figure()
728-
ax = fig.add_axes(Axes3D(fig))
730+
ax = fig.add_axes(Axes3D(fig, auto_add_to_figure=False))
729731
# labelpad respects rcParams
730732
assert ax.xaxis.labelpad == mpl.rcParams['axes.labelpad']
731733
# labelpad can be set in set_label
@@ -1148,7 +1150,8 @@ def test_inverted_cla():
11481150

11491151
def test_ax3d_tickcolour():
11501152
fig = plt.figure()
1151-
ax = Axes3D(fig)
1153+
with pytest.warns(MatplotlibDeprecationWarning):
1154+
ax = Axes3D(fig)
11521155

11531156
ax.tick_params(axis='x', colors='red')
11541157
ax.tick_params(axis='y', colors='red')

0 commit comments

Comments
 (0)