Commit 1d21b26d authored by Stefan Krah's avatar Stefan Krah

Issue #16080: Use run_with_locale() decorator to reset the locale properly.

parent 117083c8
...@@ -34,7 +34,8 @@ import numbers ...@@ -34,7 +34,8 @@ import numbers
import locale import locale
from test.support import (run_unittest, run_doctest, is_resource_enabled, from test.support import (run_unittest, run_doctest, is_resource_enabled,
requires_IEEE_754) requires_IEEE_754)
from test.support import check_warnings, import_fresh_module, TestFailed from test.support import (check_warnings, import_fresh_module, TestFailed,
run_with_locale)
import random import random
import time import time
import warnings import warnings
...@@ -1136,18 +1137,13 @@ class FormatTest(unittest.TestCase): ...@@ -1136,18 +1137,13 @@ class FormatTest(unittest.TestCase):
self.assertEqual(get_fmt(Decimal('-1.5'), dotsep_wide, '020n'), self.assertEqual(get_fmt(Decimal('-1.5'), dotsep_wide, '020n'),
'-0\u00b4000\u00b4000\u00b4000\u00b4001\u00bf5') '-0\u00b4000\u00b4000\u00b4000\u00b4001\u00bf5')
@run_with_locale('LC_ALL', 'ps_AF')
def test_wide_char_separator_decimal_point(self): def test_wide_char_separator_decimal_point(self):
# locale with wide char separator and decimal point # locale with wide char separator and decimal point
Decimal = self.decimal.Decimal Decimal = self.decimal.Decimal
try:
locale.setlocale(locale.LC_ALL, 'ps_AF')
except locale.Error:
return
self.assertEqual(format(Decimal('100000000.123'), 'n'), self.assertEqual(format(Decimal('100000000.123'), 'n'),
'100\u066c000\u066c000\u066b123') '100\u066c000\u066c000\u066b123')
locale.resetlocale()
class CFormatTest(FormatTest): class CFormatTest(FormatTest):
decimal = C decimal = C
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment