[Zodb-checkins] CVS: Packages/bsddb3Storage - test_storage_api.py:1.2
barry@digicool.com
barry@digicool.com
Tue, 3 Apr 2001 19:22:33 -0400 (EDT)
Update of /cvs-repository/Packages/bsddb3Storage/test
In directory korak:/tmp/cvs-serv24171
Modified Files:
test_storage_api.py
Log Message:
Added checkNonVersionStoreAndLoad() tests.
checkNonVersionStore(): Add some default arguments to make it useful
for checkNonVersionStoreAndLoad().
--- Updated File test_storage_api.py in package Packages/bsddb3Storage --
--- test_storage_api.py 2001/04/03 18:42:52 1.1
+++ test_storage_api.py 2001/04/03 23:22:32 1.2
@@ -56,12 +56,15 @@
self._storage.store,
0, 1, 2, 3, Transaction())
- def checkNonVersionStore(self):
+ def checkNonVersionStore(self, oid=None, revid=None, version=None):
# Some objects to store
- oid = self._storage.new_oid()
- revid = ZERO
+ if oid is None:
+ oid = self._storage.new_oid()
+ if revid is None:
+ revid = ZERO
data = pickle.dumps(7)
- version = ''
+ if version is None:
+ version = ''
# Start the transaction, store an object, and be sure the revision id
# is different than what we passed.
self._storage.tpc_begin(self._transaction)
@@ -80,6 +83,14 @@
self.checkNonVersionStore()
assert len(self._storage) == 2
+ def checkNonVersionStoreAndLoad(self):
+ oid = self._storage.new_oid()
+ self.checkNonVersionStore(oid)
+ data, revid = self._storage.load(oid, '')
+ assert revid == ZERO
+ value = pickle.loads(data)
+ assert value == 7
+
class FullStorageAPI(StorageAPI):
@@ -99,10 +110,12 @@
suite.addTest(MinimalStorageAPI('checkBasics'))
suite.addTest(MinimalStorageAPI('checkNonVersionStore'))
suite.addTest(MinimalStorageAPI('checkLen'))
+ suite.addTest(MinimalStorageAPI('checkNonVersionStoreAndLoad'))
# Full storage tests
suite.addTest(FullStorageAPI('checkBasics'))
suite.addTest(FullStorageAPI('checkNonVersionStore'))
suite.addTest(FullStorageAPI('checkLen'))
+ suite.addTest(FullStorageAPI('checkNonVersionStoreAndLoad'))
return suite