[Zope3-checkins] CVS: Zope3/lib/python/Persistence/tests - testPersistence.py:1.9

Jeremy Hylton jeremy@zope.com
Thu, 7 Nov 2002 14:05:28 -0500


Update of /cvs-repository/Zope3/lib/python/Persistence/tests
In directory cvs.zope.org:/tmp/cvs-serv2006

Modified Files:
	testPersistence.py 
Log Message:
Add some simple tests of Persistent type structure.


=== Zope3/lib/python/Persistence/tests/testPersistence.py 1.8 => 1.9 ===
--- Zope3/lib/python/Persistence/tests/testPersistence.py:1.8	Thu Oct 10 18:30:17 2002
+++ Zope3/lib/python/Persistence/tests/testPersistence.py	Thu Nov  7 14:05:28 2002
@@ -13,6 +13,7 @@
 ##############################################################################
 import unittest
 
+from Persistence import Persistent
 from Persistence.IPersistent import IPersistent
 
 class Test(unittest.TestCase):
@@ -134,7 +135,29 @@
         self.assert_('x' in p.__dict__)
         self.assert_(p._p_jar is None)
 
-from Persistence import Persistent
+    def testMultipleInheritance(self):
+        # make sure it is possible to have 
+        class A(Persistent):
+            pass
+        class B(Persistent):
+            pass
+        class C(A, B):
+            pass
+        class D(object):
+            pass
+        class E(D, B):
+            pass
+
+    def testBasicTypeStructure(self):
+        # test that a persistent class has a sane C type structure
+        # use P (defined below) as simplest example
+        self.assertEqual(Persistent.__dictoffset__, 0)
+        self.assertEqual(Persistent.__weakrefoffset__, 0)
+        self.assert_(Persistent.__basicsize__ > object.__basicsize__)
+        self.assert_(P.__dictoffset__)
+        self.assert_(P.__weakrefoffset__)
+        self.assert_(P.__dictoffset__ < P.__weakrefoffset__)
+        self.assert_(P.__basicsize__ > Persistent.__basicsize__)
 
 class P(Persistent):
     def __init__(self):