[Zodb-checkins] CVS: Zope3/src/zodb/code/tests - test_class.py:1.10 test_module.py:1.12

Jeremy Hylton jeremy at zope.com
Wed May 7 15:19:09 EDT 2003


Update of /cvs-repository/Zope3/src/zodb/code/tests
In directory cvs.zope.org:/tmp/cvs-serv26450/tests

Modified Files:
	test_class.py test_module.py 
Log Message:
Fix class patch problem reported by Paolo Invernizzi.

A bunch of small, complex fixes are involved.

MethodMixin needs to handle SimpleDescriptor missing value.
Ignore _p_oid and _p_jar in _p_newstate() for classes.
Ignore "empty" descriptors in persistent_id(), where an
   empty descr is returned when a class has no value
   associated with the descr.
Add test that create instances of persistent classes
   from other modules.


=== Zope3/src/zodb/code/tests/test_class.py 1.9 => 1.10 ===
--- Zope3/src/zodb/code/tests/test_class.py:1.9	Thu May  1 15:34:59 2003
+++ Zope3/src/zodb/code/tests/test_class.py	Wed May  7 14:19:08 2003
@@ -70,6 +70,7 @@
     def __getinitargs__(self):
         return self.var,
 
+y = Foo(11)
 x = Foo(12)""" "\n"
 
     def testClassAndInstance(self):
@@ -82,8 +83,13 @@
         self.assertEqual(Foo2(12).var, 12)
         x = self._load_name("testclass.x")
         self.assertEqual(x.var, 12)
+        y = self._load_name("testclass.y")
+        self.assertEqual(y.var, 11)
 
         self.assert_(not hasattr(x, "_p_oid"))
+        self.assert_(not hasattr(y, "_p_oid"))
+        x._p_oid = 1234
+        y._p_oid = 4321
 
     class_interface = """class Foo:
     __implements__ = 1""" + "\n"
@@ -179,6 +185,18 @@
         obj._p_oid = 1
         self.assertEqual(obj._p_oid, 1)
         self.assertEqual(persist.Foo._p_oid, foo_oid)
+
+    save_persist = """from persist import Foo
+x = Foo()
+"""
+
+    def testSavePersistentSubclass(self):
+        self.registry.newModule("persist", self.persist)
+        get_transaction().commit()
+        import persist
+        self.registry.newModule("save_persist", self.save_persist)
+        get_transaction().commit()
+        import save_persist
 
     def XXXtestUpdateClassAttribute(self):
         self.registry.newModule("parent", self.parent1)


=== Zope3/src/zodb/code/tests/test_module.py 1.11 => 1.12 ===
--- Zope3/src/zodb/code/tests/test_module.py:1.11	Thu May  1 15:34:59 2003
+++ Zope3/src/zodb/code/tests/test_module.py	Wed May  7 14:19:08 2003
@@ -362,6 +362,9 @@
         _dir, _file = os.path.split(tests.__file__)
         self._pmtest = os.path.join(_dir, "_pmtest.py")
 
+    def tearDown(self):
+        get_transaction().abort()
+
     def open(self):
         # open a new db and importer from the storage
         self.db = zodb.db.DB(self.storage)




More information about the Zodb-checkins mailing list