[Zope-Checkins] CVS: Packages/BTrees/tests - testBTrees.py:1.51.8.3

Tim Peters tim.one at comcast.net
Tue Jul 5 12:41:34 EDT 2005


Update of /cvs-repository/Packages/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv26910/BTrees/tests

Modified Files:
      Tag: Zope-2_7-branch
	testBTrees.py 
Log Message:
Collector 1831.

The BTree minKey() and maxKey() methods gave a misleading message if no
key satisfying the constraints existed in a non-empty tree.


=== Packages/BTrees/tests/testBTrees.py 1.51.8.2 => 1.51.8.3 ===
--- Packages/BTrees/tests/testBTrees.py:1.51.8.2	Mon Nov 17 17:34:04 2003
+++ Packages/BTrees/tests/testBTrees.py	Tue Jul  5 12:41:34 2005
@@ -196,6 +196,20 @@
         self.assertEqual(t.minKey(3) , 3)
         self.assertEqual(t.minKey(9) , 10)
 
+        try:
+            t.maxKey(t.minKey() - 1)
+        except ValueError, err:
+            self.assertEqual(str(err), "no key satisfies the conditions")
+        else:
+            self.fail("expected ValueError")
+
+        try:
+            t.minKey(t.maxKey() + 1)
+        except ValueError, err:
+            self.assertEqual(str(err), "no key satisfies the conditions")
+        else:
+            self.fail("expected ValueError")
+
     def testClear(self):
         r = range(100)
         for x in r:
@@ -418,6 +432,20 @@
         self.assertEqual(t.minKey() , 1)
         self.assertEqual(t.minKey(3) , 3)
         self.assertEqual(t.minKey(9) , 10)
+
+        try:
+            t.maxKey(t.minKey() - 1)
+        except ValueError, err:
+            self.assertEqual(str(err), "no key satisfies the conditions")
+        else:
+            self.fail("expected ValueError")
+
+        try:
+            t.minKey(t.maxKey() + 1)
+        except ValueError, err:
+            self.assertEqual(str(err), "no key satisfies the conditions")
+        else:
+            self.fail("expected ValueError")
 
     def testUpdate(self):
         d={}



More information about the Zope-Checkins mailing list