[pypy-svn] r76787 - pypy/branch/better-map-instances/pypy/objspace/std/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Aug 29 14:58:23 CEST 2010


Author: cfbolz
Date: Sun Aug 29 14:58:21 2010
New Revision: 76787

Modified:
   pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py
Log:
two skipped tests that pypy doesn't seem to support in general so far


Modified: pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py
==============================================================================
--- pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py	(original)
+++ pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py	Sun Aug 29 14:58:21 2010
@@ -444,3 +444,57 @@
         assert a.y == 2
         assert a.__dict__ is d
         assert isinstance(a, B)
+
+    def test_change_class_slots(self):
+        skip("not supported by pypy yet")
+        class A(object):
+            __slots__ = ["x", "y"]
+
+        class B(object):
+            __slots__ = ["x", "y"]
+
+        a = A()
+        a.x = 1
+        a.y = 2
+        assert a.x == 1
+        assert a.y == 2
+        a.__class__ = B
+        assert a.x == 1
+        assert a.y == 2
+        assert isinstance(a, B)
+
+    def test_change_class_slots_dict(self):
+        skip("not supported by pypy yet")
+        class A(object):
+            __slots__ = ["x", "__dict__"]
+        class B(object):
+            __slots__ = ["x", "__dict__"]
+        # dict accessed:
+        a = A()
+        a.x = 1
+        a.y = 2
+        assert a.x == 1
+        assert a.y == 2
+        d = a.__dict__
+        assert d == {"y": 2}
+        a.__class__ = B
+        assert a.x == 1
+        assert a.y == 2
+        assert a.__dict__ is d
+        assert d == {"y": 2}
+        assert isinstance(a, B)
+
+        # dict devolved:
+        a = A()
+        a.x = 1
+        a.y = 2
+        assert a.x == 1
+        assert a.y == 2
+        d = a.__dict__
+        d[1] = 3
+        assert d == {"x": 1, "y": 2, 1:3}
+        a.__class__ = B
+        assert a.x == 1
+        assert a.y == 2
+        assert a.__dict__ is d
+        assert isinstance(a, B)



More information about the Pypy-commit mailing list