[Zope-Checkins] CVS: Zope/lib/python/BTrees/tests - testBTrees.py:1.40
Tim Peters
tim.one@comcast.net
Thu, 13 Jun 2002 16:08:39 -0400
Update of /cvs-repository/Zope/lib/python/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv30371/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).
=== Zope/lib/python/BTrees/tests/testBTrees.py 1.39 => 1.40 ===
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.
@@ -429,6 +437,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