File tree 2 files changed +13
-12
lines changed
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):
608
608
complete description.
609
609
"""
610
610
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
623
618
624
619
# get the list of raw 'unscaled' dash patterns
625
620
self ._us_linestyles = dashes
Original file line number Diff line number Diff line change @@ -611,6 +611,12 @@ def test_lslw_bcast():
611
611
assert (col .get_linewidths () == [1 , 2 , 3 ]).all ()
612
612
613
613
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
+
614
620
@mpl .style .context ('default' )
615
621
def test_capstyle ():
616
622
col = mcollections .PathCollection ([], capstyle = 'round' )
You can’t perform that action at this time.
0 commit comments