[pypy-commit] pypy list-strategies: fix test by not putting string into list (which eats its identity)

cfbolz noreply at buildbot.pypy.org
Tue Sep 27 15:55:17 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: list-strategies
Changeset: r47632:3e0d01090056
Date: 2011-09-27 15:55 +0200
http://bitbucket.org/pypy/pypy/changeset/3e0d01090056/

Log:	fix test by not putting string into list (which eats its identity)

diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -577,15 +577,17 @@
         assert getattr(a, s) == 42
 
     def test_setattr_string_identify(self):
-        attrs = []
+        class StrHolder(object):
+            pass
+        holder = StrHolder()
         class A(object):
             def __setattr__(self, attr, value):
-                attrs.append(attr)
+                holder.seen = attr
 
         a = A()
         s = "abc"
         setattr(a, s, 123)
-        assert attrs[0] is s
+        assert holder.seen is s
 
 class AppTestDictViews:
     def test_dictview(self):


More information about the pypy-commit mailing list