[Zope-Checkins] CVS: ZODB3/Persistence/tests - testPersistent.py:1.1.2.5
Jeremy Hylton
jeremy@zope.com
Mon, 7 Jul 2003 12:15:29 -0400
Update of /cvs-repository/ZODB3/Persistence/tests
In directory cvs.zope.org:/tmp/cvs-serv8560/Persistence/tests
Modified Files:
Tag: zodb33-devel-branch
testPersistent.py
Log Message:
Add __reduce__() and remove __changed__().
Change METH_VARARGS to METH_O and METH_NOARGS as appropriate, removing
checknoargs() in the process.
Add test that persistent objects are picklable using plain old pickle.
=== ZODB3/Persistence/tests/testPersistent.py 1.1.2.4 => 1.1.2.5 ===
--- ZODB3/Persistence/tests/testPersistent.py:1.1.2.4 Thu Jul 3 17:03:42 2003
+++ ZODB3/Persistence/tests/testPersistent.py Mon Jul 7 12:15:25 2003
@@ -11,6 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+import pickle
import time
import unittest
@@ -173,6 +174,13 @@
obj._p_serial = repr(ts)
self.assertEqual(obj._p_mtime, t)
self.assert_(isinstance(obj._p_mtime, float))
+
+ def testPicklable(self):
+ obj = P()
+ obj.attr = "test"
+ s = pickle.dumps(obj)
+ obj2 = pickle.loads(s)
+ self.assertEqual(obj.attr, obj2.attr)
def testGetattr(self):
obj = H1()