Commit 95a9fded authored by Barry Warsaw's avatar Barry Warsaw

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.
parent c294cd02
...@@ -66,6 +66,22 @@ class BasicStorage: ...@@ -66,6 +66,22 @@ class BasicStorage:
0, 1, 2, 3, Transaction()) 0, 1, 2, 3, Transaction())
self._storage.tpc_abort(self._transaction) 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): def checkNonVersionStore(self, oid=None, revid=None, version=None):
revid = ZERO revid = ZERO
newrevid = self._dostore(revid=revid) newrevid = self._dostore(revid=revid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment