[Python-checkins] cpython: Issue #16080: Use run_with_locale() decorator to reset the locale properly.
stefan.krah
python-checkins at python.org
Fri Sep 28 16:29:13 CEST 2012
http://hg.python.org/cpython/rev/3f5fedb17a78
changeset: 79213:3f5fedb17a78
parent: 79210:b21e28790c03
user: Stefan Krah <skrah at bytereef.org>
date: Fri Sep 28 16:18:54 2012 +0200
summary:
Issue #16080: Use run_with_locale() decorator to reset the locale properly.
files:
Lib/test/test_decimal.py | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -34,7 +34,8 @@
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 @@
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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list