[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/FieldIndex/tests - testFieldIndex.py:1.3

Tres Seaver tseaver@zope.com
Mon, 22 Oct 2001 21:52:13 -0400


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/FieldIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv13579/lib/python/Products/PluginIndexes/FieldIndex/tests

Modified Files:
	testFieldIndex.py 
Log Message:


 - Test "record-style" parameters (caught typo on 'range', which was
   the built-in, rather than the parameter).

 - Ensure that queries which mix 'range' and 'operator' for a given index
   do the Right Thing (TM) (FieldIndexes ignore 'operator'; KeywordIndexes
   ignore 'range').


=== Zope/lib/python/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py 1.2 => 1.3 ===
             index.index_object(i, Dummy(i%10))
 
-        r=index._apply_index({
-            'foo_usage': 'range:min:max',
-            'foo': [-99, 3]})
+        record = { 'foo' : { 'query'  : [-99, 3]
+                           , 'range'  : 'min:max'
+                           }
+                 }
+        r=index._apply_index( record )
 
         assert tuple(r[1])==('foo',), r[1]
         r=list(r[0].keys())
@@ -240,6 +242,16 @@
             ]
         
         assert r==expect, r 
+
+        #
+        #   Make sure that range tests with incompatible paramters
+        #   don't return empty sets.
+        #
+        record[ 'foo' ][ 'operator' ] = 'and'
+        r2, ignore = index._apply_index( record )
+        r2 = list( r2.keys() )
+
+        assert r2 == r
 
 def test_suite():
     return unittest.makeSuite( TestCase )