Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd784c9

Browse files
committed
Handle locale unsupported error
1 parent db5472b commit dd784c9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,14 +1449,11 @@ def test_latex(self, is_latex, usetex, expected):
14491449
assert fmt.format_pct(50, 100) == expected
14501450

14511451

1452+
@pytest.mark.xfail(locale != "fy_DE.UTF-8",
1453+
reason="Locale 'fy_DE.UTF-8' is not supported")
14521454
def test_locale_comma():
1453-
import locale
1454-
14551455
currentLocale = locale.getlocale()
1456-
try:
1457-
locale.setlocale(locale.LC_ALL, 'fy_DE.UTF-8')
1458-
except locale.Error as err:
1459-
pytest.fail("Locale 'fy_DE.UTF-8' is not supported")
1456+
locale.setlocale(locale.LC_ALL, 'fy_DE.UTF-8')
14601457
ticks = mticker.ScalarFormatter(useMathText=True, useLocale=True)
14611458
fmt = '$\\mathdefault{%1.1f}$'
14621459
x = ticks._format_maybe_minus_and_locale(fmt, 0.5)

0 commit comments

Comments
 (0)