summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-09-28 14:18:54 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-09-28 14:18:54 (GMT)
commit6fb204af790dffd3829c62c4266383e84b48cc04 (patch)
tree940a03a7a69e01f3df453f41fad8260a582aae5d /Lib/test/test_decimal.py
parent8ef1fcecc546f254e8b55d50ef82a433fc280641 (diff)
downloadcpython-6fb204af790dffd3829c62c4266383e84b48cc04.zip
cpython-6fb204af790dffd3829c62c4266383e84b48cc04.tar.gz
cpython-6fb204af790dffd3829c62c4266383e84b48cc04.tar.bz2
Issue #16080: Use run_with_locale() decorator to reset the locale properly.
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 3ca5927..b2ec1a6 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -34,7 +34,8 @@ import numbers
import locale
from test.support import (run_unittest, run_doctest, is_resource_enabled,
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 time
import warnings
@@ -1136,18 +1137,13 @@ class FormatTest(unittest.TestCase):
self.assertEqual(get_fmt(Decimal('-1.5'), dotsep_wide, '020n'),
'-0\u00b4000\u00b4000\u00b4000\u00b4001\u00bf5')
+ @run_with_locale('LC_ALL', 'ps_AF')
def test_wide_char_separator_decimal_point(self):
# locale with wide char separator and decimal point
Decimal = self.decimal.Decimal
- try:
- locale.setlocale(locale.LC_ALL, 'ps_AF')
- except locale.Error:
- return
-
self.assertEqual(format(Decimal('100000000.123'), 'n'),
'100\u066c000\u066c000\u066b123')
- locale.resetlocale()
class CFormatTest(FormatTest):
decimal = C