[pypy-svn] r78344 - pypy/branch/cleanup-dict-impl/pypy/objspace/std/test

arigo at codespeak.net arigo at codespeak.net
Wed Oct 27 11:47:06 CEST 2010


Author: arigo
Date: Wed Oct 27 11:47:05 2010
New Revision: 78344

Added:
   pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_methodcache.py
      - copied, changed from r78343, pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_shadowtracking.py
Removed:
   pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_shadowtracking.py
Log:
(cfbolz, arigo)
Rename test_shadowtracking to test_methodcache, and drop the tests
about shadow tracking.


Copied: pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_methodcache.py (from r78343, pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_shadowtracking.py)
==============================================================================
--- pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_shadowtracking.py	(original)
+++ pypy/branch/cleanup-dict-impl/pypy/objspace/std/test/test_methodcache.py	Wed Oct 27 11:47:05 2010
@@ -1,119 +1,8 @@
 from pypy.conftest import gettestobjspace
 from pypy.objspace.std.test.test_typeobject import AppTestTypeObject
 
-class TestShadowTracking(object):
-    def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.withshadowtracking": True,
-                                       "objspace.std.withmapdict": False})
-
-    def test_simple_shadowing(self):
-        space = self.space
-        w_inst = space.appexec([], """():
-            class A(object):
-                def f(self):
-                    return 42
-            a = A()
-            return a
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        space.appexec([w_inst], """(a):
-            a.g = "foo"
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        space.appexec([w_inst], """(a):
-            a.f = "foo"
-        """)
-        assert w_inst.getdict().shadows_anything()
-
-    def test_shadowing_via__dict__(self):
-        space = self.space
-        w_inst = space.appexec([], """():
-            class A(object):
-                def f(self):
-                    return 42
-            a = A()
-            return a
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        space.appexec([w_inst], """(a):
-            a.__dict__["g"] = "foo"
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        space.appexec([w_inst], """(a):
-            a.__dict__["f"] = "foo"
-        """)
-        assert w_inst.getdict().shadows_anything()
-
-    def test_changing__dict__(self):
-        space = self.space
-        w_inst = space.appexec([], """():
-            class A(object):
-                def f(self):
-                    return 42
-            a = A()
-            return a
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        space.appexec([w_inst], """(a):
-            a.__dict__ = {}
-        """)
-        assert w_inst.getdict().shadows_anything()
-
-    def test_changing__class__(self):
-        space = self.space
-        w_inst = space.appexec([], """():
-            class A(object):
-                def f(self):
-                    return 42
-            a = A()
-            return a
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        space.appexec([w_inst], """(a):
-            class B(object):
-                def g(self):
-                    return 42
-            a.__class__ = B
-        """)
-        assert w_inst.getdict().shadows_anything()
-
-    def test_changing_the_type(self):
-        space = self.space
-        w_inst = space.appexec([], """():
-            class A(object):
-                pass
-            a = A()
-            a.x = 72
-            return a
-        """)
-        assert not w_inst.getdict().shadows_anything()
-        w_x = space.appexec([w_inst], """(a):
-            a.__class__.x = 42
-            return a.x
-        """)
-        assert space.unwrap(w_x) == 72
-        assert w_inst.getdict().shadows_anything()
-
-class AppTestShadowTracking(object):
-    def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.withshadowtracking": True})
-
-    def test_shadowtracking_does_not_blow_up(self):
-        class A(object):
-            def f(self):
-                return 42
-        a = A()
-        assert a.f() == 42
-        a.f = lambda : 43
-        assert a.f() == 43
-
-class AppTestTypeWithMethodCache(AppTestTypeObject):
-
-    def setup_class(cls):
-        cls.space = gettestobjspace(
-            **{"objspace.std.withmethodcachecounter" : True})
 
-class AppTestMethodCaching(AppTestShadowTracking):
+class AppTestMethodCaching(AppTestTypeObject):
     def setup_class(cls):
         cls.space = gettestobjspace(
             **{"objspace.std.withmethodcachecounter": True})



More information about the Pypy-commit mailing list