Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf7fe30

Browse files
committed
TST: Make the ArtistList tests work again
This test relies and removing and re-adding Artists from the same figure / axesrepeatedly to make sure that the correct warnings come out.Took the lazy-route of working around the validation rather than making newArtists to add.
1 parentcbde096 commitdf7fe30

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎lib/matplotlib/tests/test_axes.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8056,25 +8056,32 @@ def test_artist_sublists():
80568056
assertnotax.lines
80578057
assertnotax.tables
80588058

8059+
# Adding items should warn.
80598060
withpytest.warns(MatplotlibDeprecationWarning,
80608061
match='modification of the Axes.texts property'):
8062+
text._figure=text._axes=None
80618063
ax.texts.append(text)
80628064
withpytest.warns(MatplotlibDeprecationWarning,
80638065
match='modification of the Axes.collections property'):
8066+
col._figure=col._axes=None
80648067
ax.collections.append(col)
80658068
withpytest.warns(MatplotlibDeprecationWarning,
80668069
match='modification of the Axes.images property'):
8070+
im._figure=im._axes=None
80678071
ax.images.append(im)
80688072
withpytest.warns(MatplotlibDeprecationWarning,
80698073
match='modification of the Axes.patches property'):
8074+
patch._figure=patch._axes=None
80708075
ax.patches.append(patch)
80718076
# verify things are back
80728077
assertlist(ax.collections)== [col]
80738078
assertlist(ax.images)== [im]
80748079
assertlist(ax.patches)== [patch]
80758080
assertlist(ax.texts)== [text]
80768081

8077-
# Adding items should warn.
8082+
forlninlines:
8083+
ln._figure=ln._axes=None
8084+
80788085
withpytest.warns(MatplotlibDeprecationWarning,
80798086
match='modification of the Axes.lines property'):
80808087
ax.lines.append(lines[-2])
@@ -8091,6 +8098,10 @@ def test_artist_sublists():
80918098
# Modifying items should warn.
80928099
withpytest.warns(MatplotlibDeprecationWarning,
80938100
match='modification of the Axes.lines property'):
8101+
ax.lines[0]=mpl.lines.Line2D([], [])
8102+
withpytest.warns(MatplotlibDeprecationWarning,
8103+
match='modification of the Axes.lines property'):
8104+
lines[0]._axes=lines[0]._figure=None
80948105
ax.lines[0]=lines[0]
80958106
assertlist(ax.lines)== [lines[0],lines[-2],lines[-1]]
80968107
withpytest.warns(MatplotlibDeprecationWarning,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp