[Zope-dev] PluginIndexes, 2 bugs

Juan David Ibáñez Palomar jdavid@nuxeo.com
Tue, 27 Nov 2001 17:33:17 +0100


First bug, the module 'Products/PluginIndexes/tests/testFieldIndex.py'
contains the methods 'checkEmpty', 'checkPopulated', 'checkZero',
'checkNone' and 'checkRange'; they should be named 'testEmpty',
'testPopulated', etc.. otherwise the tests doesn't run.


Last bug, The file 'Products/PluginIndexes/README.txt' from Zope 2.4.3
says that there're two ways to pass parameters:

   old: <dtml-in myCatalog(myindex='xx yy',myindex_usage':'blabla')
   new: <dtml-in myCatalog(myindex={'query':'xx yy','usage':'....'})

And the class 'CatalogTool' in 'Products/CMFCore/CatalogTool.py'
(CMF from the CVS) uses the new way, but it doesn't works.

Add the following test case to'PluginIndexes/tests/testFieldIndex.py':

     def testNewRange(self):
         """Test a range search"""
         index = FieldIndex( 'foo' )
         for i in range(100):
             index.index_object(i, Dummy(i%10))

         r=index._apply_index({'foo': {'query': [-99, 3],
                                       'usage': 'range:min:max'}})

         assert tuple(r[1])==('foo',), r[1]
         r=list(r[0].keys())

         expect=[
             0, 1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33,
             40, 41, 42, 43, 50, 51, 52, 53, 60, 61, 62, 63, 70, 71, 72,
             73, 80, 81, 82, 83, 90, 91, 92, 93
             ]

         assert r==expect, r

This test is similar to 'testRange' but uses the new way to pass
parameters. It fails:

   AssertionError: [3, 13, 23, 33, 43, 53, 63, 73, 83, 93]


-- 
J. David Ibáñez, Nuxeo.com