[pypy-svn] r74823 - pypy/trunk/pypy/module/cpyext/test

afa at codespeak.net afa at codespeak.net
Thu May 27 19:31:01 CEST 2010


Author: afa
Date: Thu May 27 19:31:00 2010
New Revision: 74823

Modified:
   pypy/trunk/pypy/module/cpyext/test/test_typeobject.py
Log:
Next test to pass: compatibility between the metaclass and the base class.

Now I get a TypeError:
"the metaclass of a derived class must be a subclass of the metaclasses of all its bases"


Modified: pypy/trunk/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_typeobject.py	(original)
+++ pypy/trunk/pypy/module/cpyext/test/test_typeobject.py	Thu May 27 19:31:00 2010
@@ -140,8 +140,18 @@
         assert module.MetaType.__mro__ == (module.MetaType, type, object)
         x = module.MetaType('name', (), {})
         assert isinstance(x, type)
+        assert isinstance(x, module.MetaType)
         x()
 
+    @py.test.mark.xfail
+    def test_metaclass_compatible(self):
+        # metaclasses should not conflict here
+        print module.MetaType.__mro__      # (foo.Meta, type, object)
+        print type(module.fooType).__mro__ # (C_Type, type, object)
+        y = module.MetaType('other', (module.fooType,), {})
+        assert isinstance(y, module.MetaType)
+        y()
+
     def test_sre(self):
         module = self.import_module(name='_sre')
         import sre_compile



More information about the Pypy-commit mailing list