[pypy-svn] r71856 - pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test

arigo at codespeak.net arigo at codespeak.net
Sat Mar 6 13:10:03 CET 2010


Author: arigo
Date: Sat Mar  6 13:10:01 2010
New Revision: 71856

Modified:
   pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_locale.py
Log:
Fix test_locale to actually test our implementation,
not CPython's.


Modified: pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_locale.py
==============================================================================
--- pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_locale.py	(original)
+++ pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_locale.py	Sat Mar  6 13:10:01 2010
@@ -1,5 +1,5 @@
 import py
-import locale
+from pypy.lib import _locale
 import sys
 
 def setup_module(mod):
@@ -8,7 +8,7 @@
 
 class TestLocale:
     def setup_class(cls):
-        cls.oldlocale = locale.setlocale(locale.LC_NUMERIC)
+        cls.oldlocale = _locale.setlocale(_locale.LC_NUMERIC)
         if sys.platform.startswith("win"):
             cls.tloc = "en"
         elif sys.platform.startswith("freebsd"):
@@ -16,14 +16,15 @@
         else:
             cls.tloc = "en_US.UTF8"
         try:
-            locale.setlocale(locale.LC_NUMERIC, cls.tloc)
-        except locale.Error:
+            _locale.setlocale(_locale.LC_NUMERIC, cls.tloc)
+        except _locale.Error:
             py.test.skip("test locale %s not supported" % cls.tloc)
             
     def teardown_class(cls):
-        locale.setlocale(locale.LC_NUMERIC, cls.oldlocale)
+        _locale.setlocale(_locale.LC_NUMERIC, cls.oldlocale)
 
     def test_format(self):
+        py.test.skip("XXX fix or kill me")
 
         def testformat(formatstr, value, grouping = 0, output=None):
             if output:
@@ -41,8 +42,11 @@
         testformat("%20.f", -42, grouping=1, output='                 -42')
         testformat("%+10.f", -4200, grouping=1, output='    -4,200')
         testformat("%-10.f", 4200, grouping=1, output='4,200     ')
-        # Invoke getpreferredencoding to make sure it does not cause exceptions,
-        locale.getpreferredencoding()
+
+    def test_getpreferredencoding(self):
+        py.test.skip("XXX fix or kill me")
+        # Invoke getpreferredencoding to make sure it does not cause exceptions
+        _locale.getpreferredencoding()
 
     # Test BSD Rune locale's bug for isctype functions.
     def test_bsd_bug(self):
@@ -51,8 +55,8 @@
             result = getattr(s, method)()
             assert result == output
 
-        oldlocale = locale.setlocale(locale.LC_CTYPE)
-        locale.setlocale(locale.LC_CTYPE, self.tloc)
+        oldlocale = _locale.setlocale(_locale.LC_CTYPE)
+        _locale.setlocale(_locale.LC_CTYPE, self.tloc)
         try:
             teststrop('\x20', 'isspace', True)
             teststrop('\xa0', 'isspace', False)
@@ -66,4 +70,4 @@
             teststrop('\xcc\x85', 'lower', '\xcc\x85')
             teststrop('\xed\x95\xa0', 'upper', '\xed\x95\xa0')
         finally:
-            locale.setlocale(locale.LC_CTYPE, oldlocale)
+            _locale.setlocale(_locale.LC_CTYPE, oldlocale)



More information about the Pypy-commit mailing list