[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees/tests - testBTrees.py:1.9

Tim Peters tim.one@comcast.net
Thu, 13 Jun 2002 16:09:07 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv30486/tests

Modified Files:
	testBTrees.py 
Log Message:
BTree_rangeSearch():  Like its bucket counterpart, this wasn't checking
for lo > hi either, except if they happened to be in the same bucket.  All
sorts of strange results followed (the range should be empty if lo > hi,
and is after this patch).


=== Zope3/lib/python/Persistence/BTrees/tests/testBTrees.py 1.8 => 1.9 ===
         self.assertEqual(list(t.keys(9, 1)), [], list(t.keys(9, 1)))
 
+        # For IITreeSets, this one was returning 31 for len(keys), and
+        # list(keys) produced a list with 100 elements.
+        t.clear()
+        t.update(zip(range(300), range(300)))
+        keys = t.keys(200, 50)
+        self.assertEqual(len(keys), 0)
+        self.assertEqual(list(keys), [])
+
     def testSlicing(self):
         # Test that slicing of .keys()/.values()/.items() works exactly the
         # same way as slicing a Python list with the same contents.
@@ -438,6 +446,14 @@
         self.assertEqual(list(t.keys(6,8)), [], list(t.keys(6,8)))
         self.assertEqual(list(t.keys(10,12)), [], list(t.keys(10,12)))
         self.assertEqual(list(t.keys(9,1)), [], list(t.keys(9,1)))
+
+        # For IITreeSets, this one was returning 31 for len(keys), and
+        # list(keys) produced a list with 100 elements.
+        t.clear()
+        t.update(range(300))
+        keys = t.keys(200, 50)
+        self.assertEqual(len(keys), 0)
+        self.assertEqual(list(keys), [])
 
     def testSlicing(self):
         # Test that slicing of .keys() works exactly the same way as slicing