[pypy-commit] pypy py3k: adapt to py3 and kill the old range list tests again
pjenvey
noreply at buildbot.pypy.org
Tue Dec 31 01:49:46 CET 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r68574:e34541f45c3d
Date: 2013-12-30 16:48 -0800
http://bitbucket.org/pypy/pypy/changeset/e34541f45c3d/
Log: adapt to py3 and kill the old range list tests again
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -1290,15 +1290,15 @@
assert list(L([5, 6])) == ["ok"]
assert list(L([5.2, 6.3])) == ["ok"]
#
- class S(str):
+ class S(bytes):
def __iter__(self):
yield "ok"
- assert list(S("don't see me")) == ["ok"]
+ assert list(S(b"don't see me")) == ["ok"]
#
- class U(unicode):
+ class U(str):
def __iter__(self):
yield "ok"
- assert list(U(u"don't see me")) == ["ok"]
+ assert list(U("don't see me")) == ["ok"]
def test_extend_from_nonempty_list_with_subclasses(self):
l = ["hi!"]
@@ -1313,15 +1313,15 @@
l.extend(L([5, 6]))
l.extend(L([5.2, 6.3]))
#
- class S(str):
+ class S(bytes):
def __iter__(self):
yield "okS"
- l.extend(S("don't see me"))
+ l.extend(S(b"don't see me"))
#
- class U(unicode):
+ class U(str):
def __iter__(self):
yield "okU"
- l.extend(U(u"don't see me"))
+ l.extend(U("don't see me"))
#
assert l == ["hi!", "okT", "okL", "okL", "okS", "okU"]
@@ -1355,94 +1355,6 @@
assert item11 in l[::11]
-class AppTestForRangeLists(AppTestW_ListObject):
- spaceconfig = {"objspace.std.withrangelist": True}
-
- def test_range_simple_backwards(self):
- x = range(5,1)
- assert x == []
-
- def test_range_big_start(self):
- x = range(1,10)
- x[22:0:-1] == range(1,10)
-
- def test_range_list_invalid_slice(self):
- x = [1,2,3,4]
- assert x[10:0] == []
- assert x[10:0:None] == []
-
- x = range(1,5)
- assert x[10:0] == []
- assert x[10:0:None] == []
-
- assert x[0:22] == [1,2,3,4]
- assert x[-1:10] == [4]
-
- assert x[0:22:None] == [1,2,3,4]
- assert x[-1:10:None] == [4]
-
- def test_range_backwards(self):
- x = range(1,10)
- assert x[22:-10] == []
- assert x[22:-10:-1] == [9,8,7,6,5,4,3,2,1]
- assert x[10:3:-1] == [9,8,7,6,5]
- assert x[10:3:-2] == [9,7,5]
- assert x[1:5:-1] == []
-
- def test_sort_range(self):
- l = range(3,10,3)
- l.sort()
- assert l == [3, 6, 9]
- l.sort(reverse = True)
- assert l == [9, 6, 3]
- l.sort(reverse = True)
- assert l == [9, 6, 3]
- l.sort()
- assert l == [3, 6, 9]
-
- def test_slice(self):
- l = []
- l2 = range(3)
- l.__setslice__(0,3,l2)
- assert l == [0,1,2]
-
- def test_getitem(self):
- l = range(5)
- raises(IndexError, "l[-10]")
-
- def test_append(self):
- l = range(5)
- l.append(26)
- assert l == [0,1,2,3,4,26]
-
- l = range(5)
- l.append("a")
- assert l == [0,1,2,3,4,"a"]
-
- l = range(5)
- l.append(5)
- assert l == [0,1,2,3,4,5]
-
- def test_pop(self):
- l = range(3)
- assert l.pop(0) == 0
-
- def test_setitem(self):
- l = range(3)
- l[0] = 1
- assert l == [1,1,2]
-
- def test_inset(self):
- l = range(3)
- l.insert(1,5)
- assert l == [0,5,1,2]
-
- def test_reverse(self):
- l = range(3)
- l.reverse()
- assert l == [2,1,0]
-
-
class AppTestWithoutStrategies(object):
spaceconfig = {"objspace.std.withliststrategies": False}
More information about the pypy-commit
mailing list