File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -89,12 +89,18 @@ def use(style):
8989
9090
9191 """
92+ style_alias = {'mpl20' : 'default' ,
93+ 'mpl15' : 'classic' }
9294 if isinstance (style , six .string_types ) or hasattr (style , 'keys' ):
9395 # If name is a single str or dict, make it a single element list.
9496 styles = [style ]
9597 else :
9698 styles = style
9799
100+ styles = (style_alias .get (s , s )
101+ if isinstance (s , six .string_types )
102+ else s
103+ for s in styles )
98104 for style in styles :
99105 if not isinstance (style , six .string_types ):
100106 _apply_style (style )
Original file line number Diff line number Diff line change @@ -143,3 +143,18 @@ def test_context_with_badparam():
143143 with x :
144144 pass
145145 assert mpl .rcParams [PARAM ] == other_value
146+
147+
148+ @pytest .mark .parametrize ('equiv_styles' ,
149+ [('mpl20' , 'default' ),
150+ ('mpl15' , 'classic' )],
151+ ids = ['mpl20' , 'mpl15' ])
152+ def test_alias (equiv_styles ):
153+ rc_dicts = []
154+ for sty in equiv_styles :
155+ with style .context (sty ):
156+ rc_dicts .append (dict (mpl .rcParams ))
157+
158+ rc_base = rc_dicts [0 ]
159+ for nm , rc in zip (equiv_styles [1 :], rc_dicts [1 :]):
160+ assert rc_base == rc
You can’t perform that action at this time.
0 commit comments