[pypy-commit] pypy py3.5: test space.newutf8
plan_rich
pypy.commits at gmail.com
Fri Oct 14 06:44:24 EDT 2016
Author: Richard Plangger <planrichi at 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("üöä"), self.space.newunicode(u"üöä"))
+
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))
More information about the pypy-commit
mailing list