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

fix the stack remove error#7335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
JunTan wants to merge10 commits intomatplotlib:masterfromJunTan:7194
Closed
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
one more assert verifies re-add a key to the stack should not succeed…
… or modify the old one
  • Loading branch information
@JunTan
JunTan committedNov 2, 2016
commit33318e3d2c4736a5714d1d3604cdd57bf692a310
23 changes: 6 additions & 17 deletionslib/matplotlib/tests/test_figure.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
import six
from six.moves import xrange

from nose.tools import assert_equal, assert_true
from nose.tools import assert_equal, assert_true, assert_raises
from matplotlib import rcParams, figure
from matplotlib.testing.decorators import image_comparison, cleanup
from matplotlib.axes import Axes
Expand DownExpand Up@@ -219,24 +219,13 @@ def test_figaspect():

@cleanup
def test_stack_remove():
'''
Before fixing the bug, doing the following will give you following error:
>>> a.add('123',plt.figure().add_subplot(111))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 120, in
add
Stack.remove(self, (key, a_existing))
File "/usr/lib/pymodules/python2.7/matplotlib/cbook.py", line 1343, in
remove
raise ValueError('Unknown element o')
ValueError: Unknown element o
'''
key = '123'
a = figure.AxesStack()
a.add(key, plt.figure().add_subplot(111))
assert_raises(KeyError, a.add, key, plt.figure().add_subplot(111))
key = '123'
axes = plt.figure().add_subplot(111)
a.add(key, axes)
# Verify some things
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is something supposed to come after this?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

no, sorry , it should come before the assertion.

Copy link
Contributor

@trphamtrphamDec 6, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should the comment be more specific?

assert_raises(KeyError, a.add, key, plt.figure().add_subplot(111))
assert_equal(a._elements, [(key, (1, axes))])


if __name__ == "__main__":
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp