[pypy-commit] pypy remove-objspace-options: move the tests for now on-by-default identity tracking to test_typeobject

cfbolz pypy.commits at gmail.com
Fri Apr 22 03:30:28 EDT 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: remove-objspace-options
Changeset: r83820:cabe08a0a60d
Date: 2016-04-22 10:24 +0300
http://bitbucket.org/pypy/pypy/changeset/cabe08a0a60d/

Log:	move the tests for now on-by-default identity tracking to
	test_typeobject

diff --git a/pypy/objspace/std/test/test_identitydict.py b/pypy/objspace/std/test/test_identitydict.py
--- a/pypy/objspace/std/test/test_identitydict.py
+++ b/pypy/objspace/std/test/test_identitydict.py
@@ -1,59 +1,6 @@
 import py
 from pypy.interpreter.gateway import interp2app
 
-class AppTestComparesByIdentity:
-
-    def setup_class(cls):
-        from pypy.objspace.std import identitydict
-        if cls.runappdirect:
-            py.test.skip("interp2app doesn't work on appdirect")
-
-        def compares_by_identity(space, w_cls):
-            return space.wrap(w_cls.compares_by_identity())
-        cls.w_compares_by_identity = cls.space.wrap(interp2app(compares_by_identity))
-
-    def test_compares_by_identity(self):
-        class Plain(object):
-            pass
-
-        class CustomEq(object):
-            def __eq__(self, other):
-                return True
-
-        class CustomCmp (object):
-            def __cmp__(self, other):
-                return 0
-
-        class CustomHash(object):
-            def __hash__(self):
-                return 0
-
-        class TypeSubclass(type):
-            pass
-
-        class TypeSubclassCustomCmp(type):
-            def __cmp__(self, other):
-                return 0
-
-        assert self.compares_by_identity(Plain)
-        assert not self.compares_by_identity(CustomEq)
-        assert not self.compares_by_identity(CustomCmp)
-        assert not self.compares_by_identity(CustomHash)
-        assert self.compares_by_identity(type)
-        assert self.compares_by_identity(TypeSubclass)
-        assert not self.compares_by_identity(TypeSubclassCustomCmp)
-
-    def test_modify_class(self):
-        class X(object):
-            pass
-
-        assert self.compares_by_identity(X)
-        X.__eq__ = lambda x: None
-        assert not self.compares_by_identity(X)
-        del X.__eq__
-        assert self.compares_by_identity(X)
-
-
 class AppTestIdentityDict(object):
 
     def setup_class(cls):
diff --git a/pypy/objspace/std/test/test_typeobject.py b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -1238,3 +1238,57 @@
         class Y:
             __metaclass__ = X
         assert (Y < Y) is True
+
+
+class AppTestComparesByIdentity:
+
+    def setup_class(cls):
+        if cls.runappdirect:
+            py.test.skip("interp2app doesn't work on appdirect")
+
+        def compares_by_identity(space, w_cls):
+            return space.wrap(w_cls.compares_by_identity())
+        cls.w_compares_by_identity = cls.space.wrap(interp2app(compares_by_identity))
+
+    def test_compares_by_identity(self):
+        class Plain(object):
+            pass
+
+        class CustomEq(object):
+            def __eq__(self, other):
+                return True
+
+        class CustomCmp (object):
+            def __cmp__(self, other):
+                return 0
+
+        class CustomHash(object):
+            def __hash__(self):
+                return 0
+
+        class TypeSubclass(type):
+            pass
+
+        class TypeSubclassCustomCmp(type):
+            def __cmp__(self, other):
+                return 0
+
+        assert self.compares_by_identity(Plain)
+        assert not self.compares_by_identity(CustomEq)
+        assert not self.compares_by_identity(CustomCmp)
+        assert not self.compares_by_identity(CustomHash)
+        assert self.compares_by_identity(type)
+        assert self.compares_by_identity(TypeSubclass)
+        assert not self.compares_by_identity(TypeSubclassCustomCmp)
+
+    def test_modify_class(self):
+        class X(object):
+            pass
+
+        assert self.compares_by_identity(X)
+        X.__eq__ = lambda x: None
+        assert not self.compares_by_identity(X)
+        del X.__eq__
+        assert self.compares_by_identity(X)
+
+


More information about the pypy-commit mailing list