[Zope3-checkins] CVS: Zope3/src/zope/app/utilities/tests -
test_field.py:1.2 test_schemautilitypersistence.py:1.4
test_wrapper.py:1.3
Fred L. Drake, Jr.
fred at zope.com
Fri Feb 20 11:58:06 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/utilities/tests
In directory cvs.zope.org:/tmp/cvs-serv22507/src/zope/app/utilities/tests
Modified Files:
test_field.py test_schemautilitypersistence.py test_wrapper.py
Log Message:
update to replace ZODB 4 with ZODB 3
=== Zope3/src/zope/app/utilities/tests/test_field.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/utilities/tests/test_field.py:1.1 Sat Oct 18 14:56:24 2003
+++ Zope3/src/zope/app/utilities/tests/test_field.py Fri Feb 20 11:57:33 2004
@@ -13,7 +13,7 @@
##############################################################################
import unittest
-from persistence.tests.test_persistence import PersistentTest, DM
+from persistent.tests.test_persistent import PersistentTest, DM
from zope.configuration import xmlconfig
from zope.schema import Text, getFieldsInOrder
=== Zope3/src/zope/app/utilities/tests/test_schemautilitypersistence.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/utilities/tests/test_schemautilitypersistence.py:1.3 Sat Oct 18 14:56:24 2003
+++ Zope3/src/zope/app/utilities/tests/test_schemautilitypersistence.py Fri Feb 20 11:57:33 2004
@@ -18,7 +18,7 @@
import unittest
-from persistence.tests.test_persistence import PersistentTest, DM
+from persistent.tests.test_persistent import PersistentTest, DM
from zope.app.utilities.wrapper import Struct
from zope.app.utilities.schema import SchemaUtility
from zope.schema import Text, getFieldsInOrder
=== Zope3/src/zope/app/utilities/tests/test_wrapper.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/utilities/tests/test_wrapper.py:1.2 Mon Nov 24 12:37:38 2003
+++ Zope3/src/zope/app/utilities/tests/test_wrapper.py Fri Feb 20 11:57:33 2004
@@ -13,8 +13,8 @@
##############################################################################
import unittest
-from persistence import Persistent, PersistentMetaClass
-from persistence.tests.test_persistence import DM as BaseDM, BrokenDM
+from persistent import Persistent, GHOST, UPTODATE
+from persistent.tests.test_persistent import DM as BaseDM, BrokenDM
from zope.interface import Interface, directlyProvides, directlyProvidedBy
@@ -63,10 +63,8 @@
p._p_deactivate()
self.assertEqual(p._p_changed, 1)
self.assertEqual(dm.called, 1)
- p._p_deactivate(force=True)
- # XXX deal with current cPersistence implementation
- if p._p_changed != 3:
- self.assertEqual(p._p_changed, None)
+ p._p_invalidate()
+ self.assertEqual(p._p_changed, None)
self.assertEqual(dm.called, 1)
p.x += 1
self.assertEqual(p.x, 43)
@@ -98,8 +96,8 @@
self.assertEqual(p._p_changed, 0)
p._p_deactivate()
self.assertEqual(p._p_changed, 0)
- p._p_deactivate(force=True)
- self.assertEqual(p._p_changed, 0)
+ p._p_invalidate()
+ self.assertEqual(p._p_changed, None)
if self.has_dict:
self.failUnless(p.__dict__)
self.assertEqual(p.x, 2)
@@ -118,9 +116,9 @@
def testSetStateSerial(self):
p = self.klass()
- p._p_serial = 12
+ p._p_serial = 'abcdefgh'
p.__setstate__(p.__getstate__())
- self.assertEqual(p._p_serial, 12)
+ self.assertEqual(p._p_serial, 'abcdefgh')
def testDirectChanged(self):
p = self.klass()
@@ -140,9 +138,9 @@
dm = DM()
p._p_jar = dm
p._p_deactivate()
- self.assertEqual(p._p_state, 3)
+ self.assertEqual(p._p_state, GHOST)
p._p_changed = True
- self.assertEqual(p._p_state, 3)
+ self.assertEqual(p._p_state, GHOST)
def testRegistrationFailure(self):
p = self.klass()
@@ -184,7 +182,7 @@
p._p_deactivate()
# XXX does this really test the activate method?
p._p_activate()
- self.assertEqual(p._p_state, 0)
+ self.assertEqual(p._p_state, UPTODATE)
self.assertEqual(p.x, 42)
def testDeactivate(self):
@@ -192,13 +190,13 @@
dm = DM()
p._p_oid = 1
p._p_deactivate() # this deactive has no effect
- self.assertEqual(p._p_state, 0)
+ self.assertEqual(p._p_state, UPTODATE)
p._p_jar = dm
p._p_changed = 0
p._p_deactivate()
- self.assertEqual(p._p_state, 3)
+ self.assertEqual(p._p_state, GHOST)
p._p_activate()
- self.assertEqual(p._p_state, 0)
+ self.assertEqual(p._p_state, UPTODATE)
self.assertEqual(p.x, 42)
# XXX to do this right and expose both IPersistent and the
@@ -207,7 +205,7 @@
# zope.interface.
# def testInterface(self):
-# from persistence.interfaces import IPersistent
+# from persistent.interfaces import IPersistent
# self.assert_(IPersistent.isImplementedByInstancesOf(Persistent),
# "%s does not implement IPersistent" % Persistent)
# p = Persistent()
@@ -250,9 +248,9 @@
pass
class alternate(object):
__metaclass__ = alternateMeta
- class mixedMeta(alternateMeta, PersistentMetaClass):
+ class mixedMeta(alternateMeta, type):
pass
- class mixed(alternate,Persistent):
+ class mixed(alternate, Persistent):
__metaclass__ = mixedMeta
def testSlots(self):
@@ -348,6 +346,4 @@
def test_suite():
- s = unittest.TestSuite()
- s.addTest(unittest.makeSuite(PersistentTest))
- return s
+ return unittest.makeSuite(PersistentTest)
More information about the Zope3-Checkins
mailing list