[pypy-commit] pypy list-strategies: these tests fail due to integer lists. use mutable objects (lists) here instead

cfbolz noreply at buildbot.pypy.org
Tue Sep 27 15:49:08 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: list-strategies
Changeset: r47629:1ebebc4a00d2
Date: 2011-09-27 15:37 +0200
http://bitbucket.org/pypy/pypy/changeset/1ebebc4a00d2/

Log:	these tests fail due to integer lists. use mutable objects (lists)
	here instead

diff --git a/pypy/module/gc/test/test_referents.py b/pypy/module/gc/test/test_referents.py
--- a/pypy/module/gc/test/test_referents.py
+++ b/pypy/module/gc/test/test_referents.py
@@ -9,7 +9,10 @@
         w = cls.space.wrap
         class RandomRPythonObject(object):
             pass
-        cls.ALL_ROOTS = [w(4), w([2, 7]), RandomRPythonObject()]
+        l4 = space.newlist([w(4)])
+        l2 = space.newlist([w(2)])
+        l7 = space.newlist([w(7)])
+        cls.ALL_ROOTS = [l4, w([l2, l7]), RandomRPythonObject()]
         cls.w_ALL_ROOTS = cls.space.newlist(cls.ALL_ROOTS)
         rgc.get_rpy_roots = lambda: (
             map(rgc._GcRef, cls.ALL_ROOTS) + [rgc.NULL_GCREF]*17)
@@ -41,8 +44,8 @@
         if self.runappdirect:
             pass    # unsure what to test
         else:
-            assert lst[0] == 4
-            assert lst[1] == [2, 7]
+            assert lst[0] == [4]
+            assert lst[1] == [[2], [7]]
             assert type(lst[2]) is gc.GcRef
             assert len(lst) == 3
 
@@ -88,8 +91,8 @@
 
     def test_get_referents(self):
         import gc
-        y = 12345
-        z = 23456
+        y = [12345]
+        z = [23456]
         x = [y, z]
         lst = gc.get_referents(x)
         assert y in lst and z in lst


More information about the pypy-commit mailing list