[pypy-commit] pypy py3k: adapt unicode-->str and str-->bytes
antocuni
noreply at buildbot.pypy.org
Wed Mar 21 12:27:34 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r53858:5cb184143a13
Date: 2012-03-21 12:09 +0100
http://bitbucket.org/pypy/pypy/changeset/5cb184143a13/
Log: adapt unicode-->str and str-->bytes
diff --git a/pypy/objspace/std/test/test_obj.py b/pypy/objspace/std/test/test_obj.py
--- a/pypy/objspace/std/test/test_obj.py
+++ b/pypy/objspace/std/test/test_obj.py
@@ -19,9 +19,9 @@
def w_unwrap_wrap_unicode(space, w_obj):
return space.wrap(space.unicode_w(w_obj))
cls.w_unwrap_wrap_unicode = space.wrap(gateway.interp2app(w_unwrap_wrap_unicode))
- def w_unwrap_wrap_str(space, w_obj):
- return space.wrap(space.str_w(w_obj))
- cls.w_unwrap_wrap_str = space.wrap(gateway.interp2app(w_unwrap_wrap_str))
+ def w_unwrap_wrap_bytes(space, w_obj):
+ return space.wrapbytes(space.bytes_w(w_obj))
+ cls.w_unwrap_wrap_bytes = space.wrap(gateway.interp2app(w_unwrap_wrap_bytes))
def test_hash_builtin(self):
if not self.cpython_behavior:
@@ -142,10 +142,10 @@
skip("cannot run this test as apptest")
l = ["a"]
assert l[0] is l[0]
- u = u"a"
+ u = "a"
assert self.unwrap_wrap_unicode(u) is u
- s = "a"
- assert self.unwrap_wrap_str(s) is s
+ s = b"a"
+ assert self.unwrap_wrap_bytes(s) is s
def test_is_on_subclasses(self):
for typ in [int, long, float, complex, str, unicode]:
@@ -185,10 +185,10 @@
def test_id_on_strs(self):
if self.appdirect:
skip("cannot run this test as apptest")
- u = u"a"
+ u = "a"
assert id(self.unwrap_wrap_unicode(u)) == id(u)
- s = "a"
- assert id(self.unwrap_wrap_str(s)) == id(s)
+ s = b"a"
+ assert id(self.unwrap_wrap_bytes(s)) == id(s)
def test_identity_vs_id_primitives(self):
if self.cpython_apptest:
@@ -226,19 +226,19 @@
if self.appdirect:
skip("cannot run this test as apptest")
import sys
- l = range(-10, 10)
+ l = list(range(-10, 10))
for i in range(10):
- s = str(i)
+ s = bytes(i)
l.append(s)
- l.append(self.unwrap_wrap_str(s))
- u = unicode(s)
+ l.append(self.unwrap_wrap_bytes(s))
+ u = str(s)
l.append(u)
l.append(self.unwrap_wrap_unicode(u))
+ s = b"s"
+ l.append(s)
+ l.append(self.unwrap_wrap_bytes(s))
s = "s"
l.append(s)
- l.append(self.unwrap_wrap_str(s))
- s = u"s"
- l.append(s)
l.append(self.unwrap_wrap_unicode(s))
for i, a in enumerate(l):
More information about the pypy-commit
mailing list