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

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


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

Modified Files:
	testKeywordIndex.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/KeywordIndex/tests/testKeywordIndex.py 1.2 => 1.3 ===
         assert result[0] == 8
 
+    def testIntersectionWithRange(self):
+        """Test an 'and' search, ensuring that 'range' doesn't mess it up."""
+        self._populateIndex()
+
+        record = { 'foo' : { 'query'  : [ 'e', 'f' ]
+                           , 'operator' : 'and'
+                           }
+                 }
+        self._checkApply( record, self._values[6:7] )
+
+        #
+        #   Make sure that 'and' tests with incompatible paramters
+        #   don't return empty sets.
+        #
+        record[ 'foo' ][ 'range' ] = 'min:max'
+        self._checkApply( record, self._values[6:7] )
+
 def test_suite():
     return unittest.makeSuite( TestCase )