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

Commit63cc389

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR#21570: Raise correct exception out of Spines.__getattr__
1 parent6510bc4 commit63cc389

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎lib/matplotlib/spines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def __getattr__(self, name):
550550
try:
551551
returnself._dict[name]
552552
exceptKeyError:
553-
raiseValueError(
553+
raiseAttributeError(
554554
f"'Spines' object does not contain a '{name}' spine")
555555

556556
def__getitem__(self,key):

‎lib/matplotlib/tests/test_spines.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def set_val(self, val):
3535
spines[:].set_val('y')
3636
assertall(spine.val=='y'forspineinspines.values())
3737

38+
withpytest.raises(AttributeError,match='foo'):
39+
spines.foo
3840
withpytest.raises(KeyError,match='foo'):
3941
spines['foo']
4042
withpytest.raises(KeyError,match='foo, bar'):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp