File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -608,18 +608,13 @@ def set_linestyle(self, ls):
608608 complete description.
609609 """
610610 try :
611- if isinstance (ls , str ):
612- ls = cbook .ls_mapper .get (ls , ls )
613- dashes = [mlines ._get_dash_pattern (ls )]
614- else :
615- try :
616- dashes = [mlines ._get_dash_pattern (ls )]
617- except ValueError :
618- dashes = [mlines ._get_dash_pattern (x ) for x in ls ]
619-
620- except ValueError as err :
621- raise ValueError ('Do not know how to convert {!r} to '
622- 'dashes' .format (ls )) from err
611+ dashes = [mlines ._get_dash_pattern (ls )]
612+ except ValueError :
613+ try :
614+ dashes = [mlines ._get_dash_pattern (x ) for x in ls ]
615+ except ValueError as err :
616+ emsg = f'Do not know how to convert { ls !r} to dashes'
617+ raise ValueError (emsg ) from err
623618
624619 # get the list of raw 'unscaled' dash patterns
625620 self ._us_linestyles = dashes
Original file line number Diff line number Diff line change @@ -611,6 +611,12 @@ def test_lslw_bcast():
611611 assert (col .get_linewidths () == [1 , 2 , 3 ]).all ()
612612
613613
614+ def test_set_wrong_linestyle ():
615+ c = Collection ()
616+ with pytest .raises (ValueError , match = "Do not know how to convert 'fuzzy'" ):
617+ c .set_linestyle ('fuzzy' )
618+
619+
614620@mpl .style .context ('default' )
615621def test_capstyle ():
616622 col = mcollections .PathCollection ([], capstyle = 'round' )
You can’t perform that action at this time.
0 commit comments