[Zodb-checkins] CVS: ZODB3/ZODB/tests - VersionStorage.py:1.25.2.2
Jeremy Hylton
cvs-admin at zope.org
Tue Nov 11 23:30:46 EST 2003
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv19654
Modified Files:
Tag: ZODB3-mvcc-2-branch
VersionStorage.py
Log Message:
Add some tests for loadEx() with versions.
=== ZODB3/ZODB/tests/VersionStorage.py 1.25.2.1 => 1.25.2.2 ===
--- ZODB3/ZODB/tests/VersionStorage.py:1.25.2.1 Tue Oct 7 01:10:31 2003
+++ ZODB3/ZODB/tests/VersionStorage.py Tue Nov 11 23:30:45 2003
@@ -48,26 +48,37 @@
revid1 = self._dostore(oid, data=MinPO(12))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(13),
version="version")
+ data, serial, tid = self._storage.loadEx(oid, "version")
+ self.assertEqual(revid2, serial)
+ self.assertEqual(zodb_unpickle(data), MinPO(13))
+ self.assertEqual(tid, serial)
oids = self._abortVersion("version")
self.assertEqual([oid], oids)
data, revid3 = self._storage.load(oid, "")
# use repr() to avoid getting binary data in a traceback on error
self.assertEqual(`revid1`, `revid3`)
self.assertNotEqual(`revid2`, `revid3`)
+ data, serial, tid = self._storage.loadEx(oid, "")
+ self.assertEqual(revid3, serial)
+ self.assertEqual(zodb_unpickle(data), MinPO(12))
+ # The storage API doesn't expose the tid as part of the
+ # commit, so there's no
+ self.assert_(tid > serial)
+ self.assertEqual(tid, self._storage.lastTransaction())
def checkVersionedStoreAndLoad(self):
eq = self.assertEqual
# Store a couple of non-version revisions of the object
oid = self._storage.new_oid()
revid = self._dostore(oid, data=MinPO(11))
- revid = self._dostore(oid, revid=revid, data=MinPO(12))
+ revid1 = self._dostore(oid, revid=revid, data=MinPO(12))
# And now store some new revisions in a version
version = 'test-version'
- revid = self._dostore(oid, revid=revid, data=MinPO(13),
+ revid = self._dostore(oid, revid=revid1, data=MinPO(13),
version=version)
revid = self._dostore(oid, revid=revid, data=MinPO(14),
version=version)
- revid = self._dostore(oid, revid=revid, data=MinPO(15),
+ revid2 = self._dostore(oid, revid=revid, data=MinPO(15),
version=version)
# Now read back the object in both the non-version and version and
# make sure the values jive.
@@ -78,6 +89,14 @@
if hasattr(self._storage, 'getSerial'):
s = self._storage.getSerial(oid)
eq(s, max(revid, vrevid))
+ data, serial, tid = self._storage.loadEx(oid, version)
+ eq(zodb_unpickle(data), MinPO(15))
+ eq(serial, revid2)
+ eq(tid, revid2)
+ data, serial, tid = self._storage.loadEx(oid, "other version")
+ eq(zodb_unpickle(data), MinPO(12))
+ eq(serial, revid1)
+ eq(tid, revid1)
def checkVersionedLoadErrors(self):
oid = self._storage.new_oid()
More information about the Zodb-checkins
mailing list