]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Checkin the test of patch #1400181.
authorGeorg Brandl <georg@python.org>
Fri, 20 Jan 2006 17:48:57 +0000 (17:48 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 20 Jan 2006 17:48:57 +0000 (17:48 +0000)
Lib/test/test_unicode.py

index 16356b00957f3f1fefcbafe93946804a202e2297..7f8cf5097c0e8efafea8fdd96358f01fdf61f25b 100644 (file)
@@ -390,6 +390,20 @@ class UnicodeTest(
         self.assertEqual('%c' % u'a', u'a')
 
 
+    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)
+
     def test_constructor(self):
         # unicode(obj) tests (this maps to PyObject_Unicode() at C level)