[Zodb-checkins] CVS: StandaloneZODB/ZODB/tests - RevisionStorage.py:1.1 BasicStorage.py:1.10

Jeremy Hylton jeremy@zope.com
Thu, 4 Oct 2001 18:37:04 -0400


Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv13001/ZODB/tests

Modified Files:
	BasicStorage.py 
Added Files:
	RevisionStorage.py 
Log Message:
Move checkLoadSerial to RevisionStorage from BasicStorage.

It's possible for a storage to not support historical revisions, in
which case this test can't work.

Also make comment at top of BasicStorage into a doc string.




=== Added File StandaloneZODB/ZODB/tests/RevisionStorage.py ===
"""Check loadSerial() on storages that support historical revisions."""

from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle, zodb_pickle

ZERO = '\0'*8

class RevisionStorage:
    
    def checkLoadSerial(self):
        oid = self._storage.new_oid()
        revid = ZERO
        revisions = {}
        for i in range(31, 38):
            revid = self._dostore(oid, revid=revid, data=MinPO(i))
            revisions[revid] = MinPO(i)
        # Now make sure all the revisions have the correct value
        for revid, value in revisions.items():
            data = self._storage.loadSerial(oid, revid)
            self.assertEqual(zodb_unpickle(data), value)
    


=== StandaloneZODB/ZODB/tests/BasicStorage.py 1.9 => 1.10 ===
-#
-# http://www.zope.org/Documentation/Developer/Models/ZODB/ZODB_Architecture_Storage_Interface_Info.html
-#
-# All storages should be able to pass these tests
+"""Run the basic tests for a storage as described in the official storage API
+
+The most complete and most out-of-date description of the interface is:
+http://www.zope.org/Documentation/Developer/Models/ZODB/ZODB_Architecture_Storage_Interface_Info.html
+
+All storages should be able to pass these tests.
+"""
 
 from ZODB.Transaction import Transaction
 from ZODB import POSException
@@ -89,18 +91,6 @@
         self._dostore(oid=oid)
         self.assertEqual(self._storage.modifiedInVersion(oid), '')
 
-    def checkLoadSerial(self):
-        oid = self._storage.new_oid()
-        revid = ZERO
-        revisions = {}
-        for i in range(31, 38):
-            revid = self._dostore(oid, revid=revid, data=MinPO(i))
-            revisions[revid] = MinPO(i)
-        # Now make sure all the revisions have the correct value
-        for revid, value in revisions.items():
-            data = self._storage.loadSerial(oid, revid)
-            self.assertEqual(zodb_unpickle(data), value)
-    
     def checkConflicts(self):
         oid = self._storage.new_oid()
         revid1 = self._dostore(oid, data=MinPO(11))