File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,10 +142,8 @@ def __init__(self):
142142 self ._color_sequences = {** self ._BUILTIN_COLOR_SEQUENCES }
143143
144144 def __getitem__ (self , item ):
145- try :
146- return list (self ._color_sequences [item ])
147- except KeyError :
148- raise KeyError (f"{ item !r} is not a known color sequence name" )
145+ return list (_api .getitem_checked (self ._color_sequences , _error_cls = KeyError ,
146+ sequence_name = item ))
149147
150148 def __iter__ (self ):
151149 return iter (self ._color_sequences )
Original file line number Diff line number Diff line change @@ -1885,6 +1885,12 @@ def test_close_error_name():
18851885 r"'grays' is not a valid value for colormap\. "
18861886 r"Did you mean one of: 'gray', 'Grays', 'gray_r'\?" )):
18871887 matplotlib .colormaps ["grays" ]
1888+ with pytest .raises (
1889+ KeyError ,
1890+ match = (
1891+ "'set' is not a valid value for sequence_name. "
1892+ "Did you mean one of: 'Set3', 'Set2', 'Set1'?" )):
1893+ matplotlib .color_sequences ["set" ]
18881894
18891895
18901896def test_multi_norm_creation ():
You can’t perform that action at this time.
0 commit comments