[Zodb-checkins] CVS: ZODB3/ZODB/tests -
TransactionalUndoStorage.py:1.30
Jeremy Hylton
jeremy at zope.com
Thu May 8 18:57:54 EDT 2003
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv15232
Modified Files:
TransactionalUndoStorage.py
Log Message:
Remove variant copy testTransactionalUndoIterator that depended on
ZODB4.
=== ZODB3/ZODB/tests/TransactionalUndoStorage.py 1.29 => 1.30 ===
--- ZODB3/ZODB/tests/TransactionalUndoStorage.py:1.29 Thu May 8 14:48:49 2003
+++ ZODB3/ZODB/tests/TransactionalUndoStorage.py Thu May 8 17:57:53 2003
@@ -659,95 +659,6 @@
self.assertEqual(rt["test"].value, 3)
self.assertEqual(rt["test2"].value, 2)
- def testTransactionalUndoIterator(self):
- # check that data_txn set in iterator makes sense
- if not hasattr(self._storage, "iterator"):
- return
-
- s = self._storage
-
- BATCHES = 4
- OBJECTS = 4
-
- orig = []
- for i in range(BATCHES):
- t = Transaction()
- tid = p64(i + 1)
- s.tpcBegin(t, tid)
- for j in range(OBJECTS):
- oid = s.newObjectId()
- obj = MinPO(i * OBJECTS + j)
- data, refs = zodb_pickle(obj)
- revid = s.store(oid, None, data, refs, '', t)
- orig.append((tid, oid, revid))
- s.tpcVote(t)
- s.tpcFinish(t)
-
- i = 0
- for tid, oid, revid in orig:
- self._dostore(oid, revid=revid, data=MinPO(revid),
- description="update %s" % i)
-
- # Undo the OBJECTS transactions that modified objects created
- # in the ith original transaction.
-
- def undo(i):
- info = s.undoInfo()
- t = Transaction()
- s.tpcBegin(t)
- base = i * OBJECTS + i
- for j in range(OBJECTS):
- tid = info[base + j]['id']
- s.undo(tid, t)
- s.tpcVote(t)
- s.tpcFinish(t)
-
- for i in range(BATCHES):
- undo(i)
-
- # There are now (2 + OBJECTS) * BATCHES transactions:
- # BATCHES original transactions, followed by
- # OBJECTS * BATCHES modifications, followed by
- # BATCHES undos
-
- fsiter = iter(s.iterator())
- offset = 0
-
- eq = self.assertEqual
-
- for i in range(BATCHES):
- txn = fsiter.next()
- offset += 1
-
- tid = p64(i + 1)
- eq(txn.tid, tid)
-
- L1 = [(rec.oid, rec.serial, rec.data_txn) for rec in txn]
- L2 = [(oid, revid, None) for _tid, oid, revid in orig
- if _tid == tid]
-
- eq(L1, L2)
-
- for i in range(BATCHES * OBJECTS):
- txn = fsiter.next()
- offset += 1
- eq(len([rec for rec in txn if rec.data_txn is None]), 1)
-
- for i in range(BATCHES):
- txn = fsiter.next()
- offset += 1
-
- # The undos are performed in reverse order.
- otid = p64(BATCHES - i)
- L1 = [(rec.oid, rec.data_txn) for rec in txn]
- L2 = [(oid, otid) for _tid, oid, revid in orig
- if _tid == otid]
- L1.sort()
- L2.sort()
- eq(L1, L2)
-
- self.assertRaises(StopIteration, fsiter.next)
-
def checkTransactionalUndoIterator(self):
# check that data_txn set in iterator makes sense
if not hasattr(self._storage, "iterator"):
More information about the Zodb-checkins
mailing list