File tree 1 file changed +9
-8
lines changed 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 10
10
11
11
from cycler import cycler , Cycler
12
12
13
+ try :
14
+ from unittest import mock
15
+ except ImportError :
16
+ import mock
13
17
import matplotlib as mpl
14
18
import matplotlib .pyplot as plt
15
19
from matplotlib .tests import assert_str_equal
@@ -224,16 +228,13 @@ def test_legend_edgecolor():
224
228
yield _legend_rcparam_helper , rc_dict , target , get_func
225
229
226
230
227
- def test_Issue_1713 ():
231
+ def test_unicode_parsing ():
232
+ # Related issue #1713
228
233
utf32_be = os .path .join (os .path .dirname (__file__ ),
229
234
'test_utf32_be_rcparams.rc' )
230
- old_lang = os .environ .get ('LANG' , None )
231
- os .environ ['LANG' ] = 'en_US.UTF-32-BE'
232
- rc = mpl .rc_params_from_file (utf32_be , True )
233
- if old_lang :
234
- os .environ ['LANG' ] = old_lang
235
- else :
236
- del os .environ ['LANG' ]
235
+ import locale
236
+ with mock .patch ('locale.getpreferredencoding' , return_value = 'UTF-32-BE' ):
237
+ rc = mpl .rc_params_from_file (utf32_be , True , False )
237
238
assert rc .get ('timezone' ) == 'UTC'
238
239
239
240
You can’t perform that action at this time.
0 commit comments