[pypy-svn] r48463 - in pypy/branch/pypy-rpython-unicode: annotation rpython rpython/test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Nov 9 11:26:23 CET 2007


Author: cfbolz
Date: Fri Nov  9 11:26:22 2007
New Revision: 48463

Modified:
   pypy/branch/pypy-rpython-unicode/annotation/unaryop.py
   pypy/branch/pypy-rpython-unicode/rpython/rstr.py
   pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py
Log:
unicode.decode doesn't make any sense! it should be unicode.encode


Modified: pypy/branch/pypy-rpython-unicode/annotation/unaryop.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/annotation/unaryop.py	(original)
+++ pypy/branch/pypy-rpython-unicode/annotation/unaryop.py	Fri Nov  9 11:26:22 2007
@@ -462,7 +462,7 @@
         return str.basestringclass()
 
 class __extend__(SomeUnicodeString):
-    def method_decode(uni, s_enc):
+    def method_encode(uni, s_enc):
         if not s_enc.is_constant():
             raise TypeError("Non-constant decoding not supported")
         enc = s_enc.const

Modified: pypy/branch/pypy-rpython-unicode/rpython/rstr.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/rstr.py	(original)
+++ pypy/branch/pypy-rpython-unicode/rpython/rstr.py	Fri Nov  9 11:26:22 2007
@@ -267,7 +267,7 @@
         return s
 
 class __extend__(AbstractUnicodeRepr):
-    def rtype_method_decode(self, hop):
+    def rtype_method_encode(self, hop):
         v_self = hop.inputarg(self, 0)
         return hop.gendirectcall(self.ll_str, v_self)
 

Modified: pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py	(original)
+++ pypy/branch/pypy-rpython-unicode/rpython/test/test_runicode.py	Fri Nov  9 11:26:22 2007
@@ -81,10 +81,10 @@
         assert self.ll_to_string(self.interpret(f, [38])) == f(38)
         self.interpret_raises(ValueError, f, [1234])
 
-    def test_unicode_decode(self):
+    def test_unicode_encode(self):
         def f(x):
             y = u'xxx'
-            return (y + unichr(x)).decode('ascii')
+            return (y + unichr(x)).encode('ascii')
 
         assert self.ll_to_string(self.interpret(f, [38])) == f(38)
 



More information about the Pypy-commit mailing list