[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog/tests - testCatalog.py:1.16

Shane Hathaway shane@cvs.zope.org
Wed, 31 Jul 2002 13:05:59 -0400


Update of /cvs-repository/Zope/lib/python/Products/ZCatalog/tests
In directory cvs.zope.org:/tmp/cvs-serv12432/tests

Modified Files:
	testCatalog.py 
Log Message:
Fixed the optimization in the catalog that iterates over the sort index
rather than the result set when the result set is much larger than the
sort index.  Added a test and cleaned up the test framework.


=== Zope/lib/python/Products/ZCatalog/tests/testCatalog.py 1.15 => 1.16 ===
         a = self._catalog(att3='att3', att2='att2')
         assert len(a) == self.upper
 
+    def testLargeSortedResultSetWithSmallIndex(self):
+        # This exercises the optimization in the catalog that iterates
+        # over the sort index rather than the result set when the result
+        # set is much larger than the sort index.
+        a = self._catalog(sort_on='att1')
+        self.assertEqual(len(a), self.upper)
+        
+
 class objRS(ExtensionClass.Base):
 
     def __init__(self,num):
@@ -350,8 +358,5 @@
     suite.addTest( unittest.makeSuite( testRS ) )
     return suite
 
-def main():
-    unittest.TextTestRunner().run(test_suite())
-
 if __name__ == '__main__':
-    main()
+    unittest.main(defaultTest='test_suite')