[pypy-svn] pypy default: Fix test when run with a CPython before 2.7

amauryfa commits-noreply at bitbucket.org
Fri Feb 11 10:10:19 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41813:3b23b78bf46c
Date: 2011-02-11 09:25 +0100
http://bitbucket.org/pypy/pypy/changeset/3b23b78bf46c/

Log:	Fix test when run with a CPython before 2.7

diff --git a/pypy/rlib/test/test_runicode.py b/pypy/rlib/test/test_runicode.py
--- a/pypy/rlib/test/test_runicode.py
+++ b/pypy/rlib/test/test_runicode.py
@@ -310,18 +310,24 @@
 class TestEncoding(UnicodeTests):
     def test_all_ascii(self):
         for i in range(128):
-            for encoding in "utf-7 utf-8 latin-1 ascii".split():
+            if sys.version >= "2.7":
+                self.checkencode(unichr(i), "utf-7")
+            for encoding in "utf-8 latin-1 ascii".split():
                 self.checkencode(unichr(i), encoding)
 
     def test_all_first_256(self):
         for i in range(256):
-            for encoding in ("utf-7 utf-8 utf-16 utf-16-be utf-16-le "
+            if sys.version >= "2.7":
+                self.checkencode(unichr(i), "utf-7")
+            for encoding in ("utf-8 utf-16 utf-16-be utf-16-le "
                              "utf-32 utf-32-be utf-32-le").split():
                 self.checkencode(unichr(i), encoding)
 
     def test_first_10000(self):
         for i in range(10000):
-            for encoding in ("utf-7 utf-8 utf-16 utf-16-be utf-16-le "
+            if sys.version >= "2.7":
+                self.checkencode(unichr(i), "utf-7")
+            for encoding in ("utf-8 utf-16 utf-16-be utf-16-le "
                              "utf-32 utf-32-be utf-32-le").split():
                 self.checkencode(unichr(i), encoding)
 
@@ -331,7 +337,9 @@
             if 0xd800 <= v <= 0xdfff:
                 continue
             uni = unichr(v)
-            for encoding in ("utf-7 utf-8 utf-16 utf-16-be utf-16-le "
+            if sys.version >= "2.7":
+                self.checkencode(uni, "utf-7")
+            for encoding in ("utf-8 utf-16 utf-16-be utf-16-le "
                              "utf-32 utf-32-be utf-32-le").split():
                 self.checkencode(uni, encoding)                
 


More information about the Pypy-commit mailing list