[Zodb-checkins] CVS: StandaloneZODB/ZODB/tests - IteratorStorage.py:1.11

Tim Peters tim.one@home.com
Fri, 25 Jan 2002 18:01:59 -0500


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

Modified Files:
	IteratorStorage.py 
Log Message:
checkExtendedIteration():  On Windows revids are often consecutive
integers, due to MS's slothful 18.2Hz updating of time.time().  The test
implicitly assumed in one spot that "the midpoint" between two revids was
strictly larger than the smaller one, but that wasn't true on Windows.
Adjusted the computation (as suggested by Guido) so that "strictly larger"
holds in the end even when the inputs are adjacent integers.


=== StandaloneZODB/ZODB/tests/IteratorStorage.py 1.10 => 1.11 ===
         txniter = self._storage.iterator(revid2, revid3a)
         self.iter_verify(txniter, [revid2, revid3], 12)
-        # Specify a lower bound somewhere in between values
-        revid1a = p64((U64(revid1) + U64(revid2)) / 2)
+        # Specify a lower bound somewhere in between values.
+        # revid2 == revid1+1 is very likely on Windows.  Adding 1 before
+        # dividing ensures that "the midpoint" we compute is strictly larger
+        # than revid1.
+        revid1a = p64((U64(revid1) + 1 + U64(revid2)) / 2)
+        assert revid1 < revid1a
         txniter = self._storage.iterator(revid1a, revid3a)
         self.iter_verify(txniter, [revid2, revid3], 12)
         # Specify an empty range
@@ -139,7 +143,7 @@
         # Specify a singleton range
         txniter = self._storage.iterator(revid3, revid3)
         self.iter_verify(txniter, [revid3], 13)
-        
+
 class IteratorDeepCompare:
     def compare(self, storage1, storage2):
         eq = self.assertEqual