[Zodb-checkins] CVS: Zope3/src/zodb/storage/tests - readonly.py:1.7
Barry Warsaw
barry@wooz.org
Mon, 17 Mar 2003 14:48:51 -0500
Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv19555
Modified Files:
readonly.py
Log Message:
cosmetic
=== Zope3/src/zodb/storage/tests/readonly.py 1.6 => 1.7 ===
--- Zope3/src/zodb/storage/tests/readonly.py:1.6 Thu Mar 13 16:32:29 2003
+++ Zope3/src/zodb/storage/tests/readonly.py Mon Mar 17 14:48:51 2003
@@ -16,6 +16,7 @@
from zodb.storage.interfaces import ReadOnlyError, IUndoStorage
from zodb.ztransaction import Transaction
+
class ReadOnlyStorage:
def _create_data(self):
# test a read-only storage that already has some data
@@ -28,32 +29,30 @@
def _make_readonly(self):
self._storage.close()
self.open(read_only=True)
- self.assert_(self._storage.isReadOnly())
+ self.failUnless(self._storage.isReadOnly())
def checkReadMethods(self):
+ eq = self.assertEqual
+ unless = self.failUnless
self._create_data()
self._make_readonly()
# XXX not going to bother checking all read methods
for oid in self.oids.keys():
data, revid = self._storage.load(oid, '')
- self.assertEqual(revid, self.oids[oid])
- self.assert_(not self._storage.modifiedInVersion(oid))
+ eq(revid, self.oids[oid])
+ unless(not self._storage.modifiedInVersion(oid))
if IUndoStorage.isImplementedBy(self._storage):
_data = self._storage.loadSerial(oid, revid)
- self.assertEqual(data, _data)
+ eq(data, _data)
def checkWriteMethods(self):
+ raises = self.assertRaises
self._make_readonly()
t = Transaction()
- self.assertRaises(ReadOnlyError, self._storage.newObjectId)
- self.assertRaises(ReadOnlyError, self._storage.tpcBegin, t)
- self.assertRaises(ReadOnlyError, self._storage.abortVersion,
- '', t)
- self.assertRaises(ReadOnlyError, self._storage.commitVersion,
- '', '', t)
- self.assertRaises(ReadOnlyError, self._storage.store,
- ZERO, None, '', '', '', t)
-
+ raises(ReadOnlyError, self._storage.newObjectId)
+ raises(ReadOnlyError, self._storage.tpcBegin, t)
+ raises(ReadOnlyError, self._storage.abortVersion, '', t)
+ raises(ReadOnlyError, self._storage.commitVersion, '', '', t)
+ raises(ReadOnlyError, self._storage.store, ZERO, None, '', '', '', t)
if IUndoStorage.isImplementedBy(self._storage):
- self.assertRaises(ReadOnlyError, self._storage.undo,
- ZERO, t)
+ raises(ReadOnlyError, self._storage.undo, ZERO, t)