[Zope3-checkins] CVS: Zope3/src/zope/app/utilities/tests - test_wrapper.py:1.2.4.4

Fred L. Drake, Jr. fred at zope.com
Fri Jan 16 16:28:11 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/utilities/tests
In directory cvs.zope.org:/tmp/cvs-serv23274

Modified Files:
      Tag: zope3-zodb3-devel-branch
	test_wrapper.py 
Log Message:
- use constant to check object's persistence state


=== Zope3/src/zope/app/utilities/tests/test_wrapper.py 1.2.4.3 => 1.2.4.4 ===
--- Zope3/src/zope/app/utilities/tests/test_wrapper.py:1.2.4.3	Fri Jan 16 11:23:05 2004
+++ Zope3/src/zope/app/utilities/tests/test_wrapper.py	Fri Jan 16 16:28:10 2004
@@ -13,7 +13,7 @@
 ##############################################################################
 import unittest
 
-from persistent import Persistent
+from persistent import Persistent, GHOST, UPTODATE
 from persistent.tests.test_persistence 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




More information about the Zope3-Checkins mailing list