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

Commit5d60904

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 parentc5eb535 commit5d60904

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
@@ -8103,25 +8103,32 @@ def test_artist_sublists():
81038103
assertnotax.lines
81048104
assertnotax.tables
81058105

8106+
# Adding items should warn.
81068107
withpytest.warns(MatplotlibDeprecationWarning,
81078108
match='modification of the Axes.texts property'):
8109+
text._figure=text._axes=None
81088110
ax.texts.append(text)
81098111
withpytest.warns(MatplotlibDeprecationWarning,
81108112
match='modification of the Axes.collections property'):
8113+
col._figure=col._axes=None
81118114
ax.collections.append(col)
81128115
withpytest.warns(MatplotlibDeprecationWarning,
81138116
match='modification of the Axes.images property'):
8117+
im._figure=im._axes=None
81148118
ax.images.append(im)
81158119
withpytest.warns(MatplotlibDeprecationWarning,
81168120
match='modification of the Axes.patches property'):
8121+
patch._figure=patch._axes=None
81178122
ax.patches.append(patch)
81188123
# verify things are back
81198124
assertlist(ax.collections)== [col]
81208125
assertlist(ax.images)== [im]
81218126
assertlist(ax.patches)== [patch]
81228127
assertlist(ax.texts)== [text]
81238128

8124-
# Adding items should warn.
8129+
forlninlines:
8130+
ln._figure=ln._axes=None
8131+
81258132
withpytest.warns(MatplotlibDeprecationWarning,
81268133
match='modification of the Axes.lines property'):
81278134
ax.lines.append(lines[-2])
@@ -8138,6 +8145,10 @@ def test_artist_sublists():
81388145
# Modifying items should warn.
81398146
withpytest.warns(MatplotlibDeprecationWarning,
81408147
match='modification of the Axes.lines property'):
8148+
ax.lines[0]=mpl.lines.Line2D([], [])
8149+
withpytest.warns(MatplotlibDeprecationWarning,
8150+
match='modification of the Axes.lines property'):
8151+
lines[0]._axes=lines[0]._figure=None
81418152
ax.lines[0]=lines[0]
81428153
assertlist(ax.lines)== [lines[0],lines[-2],lines[-1]]
81438154
withpytest.warns(MatplotlibDeprecationWarning,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp