[Zope-Checkins] CVS: StandaloneZODB/ZODB/tests - BasicStorage.py:1.13

Barry Warsaw barry@wooz.org
Fri, 2 Nov 2001 14:32:45 -0500


Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv29691

Modified Files:
	BasicStorage.py 
Log Message:
checkSerialIsNoneForInitialRevision(): New test that checks for
acceptability of serials=None for the object-creation store() call.
Note that _dostore() itself never exercises this condition because it
coerces its own serial argument to ZERO (a.k.a. '\0'*8) when None is
passed in.


=== StandaloneZODB/ZODB/tests/BasicStorage.py 1.12 => 1.13 ===
         self._storage.tpc_abort(self._transaction)
 
+    def checkSerialIsNoneForInitialRevision(self):
+        eq = self.assertEqual
+        oid = self._storage.new_oid()
+        txn = self._transaction
+        self._storage.tpc_begin(txn)
+        # Use None for serial.  Don't use _dostore() here because that coerces
+        # serial=None to serial=ZERO.
+        newrevid = self._storage.store(oid, None, zodb_pickle(MinPO(11)),
+                                       '', txn)
+        self._storage.tpc_vote(txn)
+        self._storage.tpc_finish(txn)
+        data, revid = self._storage.load(oid, '')
+        value = zodb_unpickle(data)
+        eq(value, MinPO(11))
+        eq(revid, newrevid)
+
     def checkNonVersionStore(self, oid=None, revid=None, version=None):
         revid = ZERO
         newrevid = self._dostore(revid=revid)