[pypy-svn] r40102 - in pypy/dist/pypy/objspace/std: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Mar 8 23:03:07 CET 2007


Author: cfbolz
Date: Thu Mar  8 23:03:06 2007
New Revision: 40102

Modified:
   pypy/dist/pypy/objspace/std/dictmultiobject.py
   pypy/dist/pypy/objspace/std/test/test_dictmultiobject.py
Log:
fix bug. sharing dicts are not really that well tested, I fear, since the dict
tests don't instantiate sharing dicts.


Modified: pypy/dist/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictmultiobject.py	(original)
+++ pypy/dist/pypy/objspace/std/dictmultiobject.py	Thu Mar  8 23:03:06 2007
@@ -767,7 +767,7 @@
 
     def items(self):
         space = self.space
-        return [(space.wrap(key), self.entries[item])
+        return [space.newtuple([space.wrap(key), self.entries[item]])
                     for (key, item) in self.structure.keys.iteritems()
                         if item >= 0]
 

Modified: pypy/dist/pypy/objspace/std/test/test_dictmultiobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_dictmultiobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_dictmultiobject.py	Thu Mar  8 23:03:06 2007
@@ -46,6 +46,14 @@
         l[0] = 24
         assert a.abc == 12
 
+    def test_items(self):
+        class A(object):
+            pass
+        a = A()
+        a.abc = 12
+        a.__dict__.items() == [("abc", 12)]
+
+
 class TestW_DictSmall(test_dictobject.TestW_DictObject):
     def setup_class(cls):
         cls.space = gettestobjspace(**{"objspace.std.withsmalldicts": True})



More information about the Pypy-commit mailing list