Author: Richard Plangger <planri...@gmail.com>
Branch: py3.5
Changeset: r87784:81dd744bfbd3
Date: 2016-10-14 12:43 +0200
http://bitbucket.org/pypy/pypy/changeset/81dd744bfbd3/

Log:    test space.newutf8

diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -355,7 +355,7 @@
         return W_BytearrayObject(l)
 
     def newutf8(self, string):
-        return self.newunicode(decode_utf8(string))
+        return self.newunicode(decode_utf8(self, string))
 
     def newunicode(self, uni):
         return W_UnicodeObject(uni)
diff --git a/pypy/objspace/std/test/test_stdobjspace.py 
b/pypy/objspace/std/test/test_stdobjspace.py
--- a/pypy/objspace/std/test/test_stdobjspace.py
+++ b/pypy/objspace/std/test/test_stdobjspace.py
@@ -1,3 +1,4 @@
+# coding: utf-8
 import py
 from py.test import raises
 from pypy.interpreter.error import OperationError
@@ -11,6 +12,10 @@
                           self.space.wrap,
                           self.space.wrap(0))
 
+    def test_utf8(self):
+        assert self.space.isinstance_w(self.space.newutf8("abc"), 
self.space.w_unicode)
+        assert self.space.eq_w(self.space.newutf8("&#252;&#246;&#228;"), 
self.space.newunicode(u"&#252;&#246;&#228;"))
+
     def test_str_w_non_str(self):
         raises(OperationError,self.space.str_w,self.space.wrap(None))
         raises(OperationError,self.space.str_w,self.space.wrap(0))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to