summaryrefslogtreecommitdiff
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-04-30 11:13:56 +0000
committerGeorg Brandl <georg@python.org>2006-04-30 11:13:56 +0000
commitde9b624fb943295263f8140d9d2eda393348b8ec (patch)
tree5d2af20626e9afd98486b718235fa1f9b466812e /Lib/test/test_unicode.py
parent44a118af5043ed6919bd1d0bcfc603f496ae4d7c (diff)
downloadcpython-git-de9b624fb943295263f8140d9d2eda393348b8ec.tar.gz
Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.
On the way, add a decorator to test_support to facilitate running single test functions in different locales with automatic cleanup.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index c7113b5b4e..2858d1dbf9 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -410,20 +410,11 @@ class UnicodeTest(
def __str__(self):
return u'\u1234'
self.assertEqual('%s' % Wrapper(), u'\u1234')
-
+
+ @test_support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR')
def test_format_float(self):
- try:
- import locale
- orig_locale = locale.setlocale(locale.LC_ALL)
- locale.setlocale(locale.LC_ALL, 'de_DE')
- except (ImportError, locale.Error):
- return # skip if we can't set locale
-
- try:
- # should not format with a comma, but always with C locale
- self.assertEqual(u'1.0', u'%.1f' % 1.0)
- finally:
- locale.setlocale(locale.LC_ALL, orig_locale)
+ # should not format with a comma, but always with C locale
+ self.assertEqual(u'1.0', u'%.1f' % 1.0)
def test_constructor(self):
# unicode(obj) tests (this maps to PyObject_Unicode() at C level)