[Zodb-checkins] CVS: ZODB3/ZODB/tests - TransactionalUndoVersionStorage.py:1.9
Barry Warsaw
barry@wooz.org
Tue, 22 Oct 2002 19:09:42 -0400
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv21680
Modified Files:
TransactionalUndoVersionStorage.py
Log Message:
checkUndoInVersion(): Change all the `assert's to self.assertEqual()
via a convenient local variable.
=== ZODB3/ZODB/tests/TransactionalUndoVersionStorage.py 1.8 => 1.9 ===
--- ZODB3/ZODB/tests/TransactionalUndoVersionStorage.py:1.8 Wed Aug 14 18:07:09 2002
+++ ZODB3/ZODB/tests/TransactionalUndoVersionStorage.py Tue Oct 22 19:09:41 2002
@@ -30,6 +30,8 @@
return self._dostore(*args, **kwargs)
def checkUndoInVersion(self):
+ eq = self.assertEqual
+ unless = self.failUnless
oid = self._storage.new_oid()
version = 'one'
revid_a = self._dostore(oid, data=MinPO(91))
@@ -44,31 +46,31 @@
oids = self._storage.transactionalUndo(tid, t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
- assert len(oids) == 1
- assert oids[0] == oid
+ eq(len(oids), 1)
+ eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
- assert revid == revid_a
- assert zodb_unpickle(data) == MinPO(91)
+ eq(revid, revid_a)
+ eq(zodb_unpickle(data), MinPO(91))
data, revid = self._storage.load(oid, version)
- assert revid > revid_b and revid > revid_c
- assert zodb_unpickle(data) == MinPO(92)
+ unless(revid > revid_b and revid > revid_c)
+ eq(zodb_unpickle(data), MinPO(92))
# Now commit the version...
t = Transaction()
self._storage.tpc_begin(t)
oids = self._storage.commitVersion(version, '', t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
- assert len(oids) == 1
- assert oids[0] == oid
+ eq(len(oids), 1)
+ eq(oids[0], oid)
#JF# No, because we fall back to non-version data.
#JF# self.assertRaises(POSException.VersionError,
#JF# self._storage.load,
#JF# oid, version)
data, revid = self._storage.load(oid, version)
- assert zodb_unpickle(data) == MinPO(92)
+ eq(zodb_unpickle(data), MinPO(92))
data, revid = self._storage.load(oid, '')
- assert zodb_unpickle(data) == MinPO(92)
+ eq(zodb_unpickle(data), MinPO(92))
# ...and undo the commit
info=self._storage.undoInfo()
tid=info[0]['id']
@@ -77,20 +79,20 @@
oids = self._storage.transactionalUndo(tid, t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
- assert len(oids) == 1
- assert oids[0] == oid
+ eq(len(oids), 1)
+ eq(oids[0], oid)
data, revid = self._storage.load(oid, version)
- assert zodb_unpickle(data) == MinPO(92)
+ eq(zodb_unpickle(data), MinPO(92))
data, revid = self._storage.load(oid, '')
- assert zodb_unpickle(data) == MinPO(91)
+ eq(zodb_unpickle(data), MinPO(91))
# Now abort the version
t = Transaction()
self._storage.tpc_begin(t)
oids = self._storage.abortVersion(version, t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
- assert len(oids) == 1
- assert oids[0] == oid
+ eq(len(oids), 1)
+ eq(oids[0], oid)
# The object should not exist in the version now, but it should exist
# in the non-version
#JF# No, because we fall back
@@ -98,9 +100,9 @@
#JF# self._storage.load,
#JF# oid, version)
data, revid = self._storage.load(oid, version)
- assert zodb_unpickle(data) == MinPO(91)
+ eq(zodb_unpickle(data), MinPO(91))
data, revid = self._storage.load(oid, '')
- assert zodb_unpickle(data) == MinPO(91)
+ eq(zodb_unpickle(data), MinPO(91))
# Now undo the abort
info=self._storage.undoInfo()
tid=info[0]['id']
@@ -109,13 +111,13 @@
oids = self._storage.transactionalUndo(tid, t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
- assert len(oids) == 1
- assert oids[0] == oid
+ eq(len(oids), 1)
+ eq(oids[0], oid)
# And the object should be back in versions 'one' and ''
data, revid = self._storage.load(oid, version)
- assert zodb_unpickle(data) == MinPO(92)
+ eq(zodb_unpickle(data), MinPO(92))
data, revid = self._storage.load(oid, '')
- assert zodb_unpickle(data) == MinPO(91)
+ eq(zodb_unpickle(data), MinPO(91))
def checkUndoCommitVersion(self):
def load_value(oid, version=''):