Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6771a18

Browse filesBrowse files
authored
Merge pull request matplotlib#7328 from Kojoley/fix-rcparam-unicode-parsing-test
TST: Fixed rcparams `test_Issue_1713` test
2 parents a7e5f6f + 70285e1 commit 6771a18
Copy full SHA for 6771a18

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

‎lib/matplotlib/tests/test_rcparams.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_rcparams.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
from cycler import cycler, Cycler
1212
import pytest
1313

14+
try:
15+
from unittest import mock
16+
except ImportError:
17+
import mock
1418
import matplotlib as mpl
1519
import matplotlib.pyplot as plt
1620
from matplotlib.tests import assert_str_equal
@@ -210,13 +214,9 @@ def test_legend_colors(color_type, param_dict, target):
210214
def test_Issue_1713():
211215
utf32_be = os.path.join(os.path.dirname(__file__),
212216
'test_utf32_be_rcparams.rc')
213-
old_lang = os.environ.get('LANG', None)
214-
os.environ['LANG'] = 'en_US.UTF-32-BE'
215-
rc = mpl.rc_params_from_file(utf32_be, True)
216-
if old_lang:
217-
os.environ['LANG'] = old_lang
218-
else:
219-
del os.environ['LANG']
217+
import locale
218+
with mock.patch('locale.getpreferredencoding', return_value='UTF-32-BE'):
219+
rc = mpl.rc_params_from_file(utf32_be, True, False)
220220
assert rc.get('timezone') == 'UTC'
221221

222222

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.