[pypy-commit] pypy py3k: Fix tuple tests

amauryfa noreply at buildbot.pypy.org
Sat Jan 28 17:57:27 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r51917:975692f436ef
Date: 2012-01-28 13:46 +0100
http://bitbucket.org/pypy/pypy/changeset/975692f436ef/

Log:	Fix tuple tests

diff --git a/pypy/objspace/std/test/test_specialisedtupleobject.py b/pypy/objspace/std/test/test_specialisedtupleobject.py
--- a/pypy/objspace/std/test/test_specialisedtupleobject.py
+++ b/pypy/objspace/std/test/test_specialisedtupleobject.py
@@ -79,7 +79,7 @@
     def w_isspecialised(self, obj, expected=''):
         import __pypy__
         r = __pypy__.internal_repr(obj)
-        print obj, '==>', r, '   (expected: %r)' % expected
+        print(obj, '==>', r, '   (expected: %r)' % expected)
         return ("SpecialisedTupleObject" + expected) in r
 
     def test_createspecialisedtuple(self):
@@ -105,7 +105,7 @@
 
     def test_delegation(self):
         t = self.forbid_delegation((42, 43))
-        raises(ReferenceError, t.__getslice__, 0, 1)
+        raises(ReferenceError, t.__contains__, 0)
 
     def test_len(self):
         t = self.forbid_delegation((42,43))
@@ -147,7 +147,7 @@
         b = (1,3,2)
         assert not a == b
 
-        values = [2, 2L, 2.0, 1, 1L, 1.0]
+        values = [2, 2.0, 1, 1.0]
         for x in values:
             for y in values:
                 assert ((1,2) == (x,y)) == (1 == x and 2 == y)
@@ -204,7 +204,7 @@
         c = (2,4)
         assert hash(a) != hash(c)
 
-        assert hash(a) == hash((1L, 2L)) == hash((1.0, 2.0)) == hash((1.0, 2L))
+        assert hash(a) == hash((1, 2)) == hash((1.0, 2.0)) == hash((1.0, 2))
 
     def test_getitem(self):
         t = self.forbid_delegation((5,3))
diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py
--- a/pypy/objspace/std/test/test_tupleobject.py
+++ b/pypy/objspace/std/test/test_tupleobject.py
@@ -257,10 +257,10 @@
     def test_iter(self):
         t = (5,3,99)
         i = iter(t)
-        assert i.next() == 5
-        assert i.next() == 3
-        assert i.next() == 99
-        raises(StopIteration, i.next)
+        assert next(i) == 5
+        assert next(i) == 3
+        assert next(i) == 99
+        raises(StopIteration, next, i)
 
     def test_contains(self):
         t = (5,3,99)
@@ -332,7 +332,7 @@
         assert repr((1,2,3)) == '(1, 2, 3)'
 
     def test_getslice(self):
-        assert ('a', 'b', 'c').__getslice__(-17, 2) == ('a', 'b')
+        assert ('a', 'b', 'c')[-17: 2] == ('a', 'b')
 
     def test_count(self):
         assert ().count(4) == 0


More information about the pypy-commit mailing list