[Zope-Checkins] CVS: Products/PluginIndexes/KeywordIndex/tests - testKeywordIndex.py:1.6.12.2

Tres Seaver tseaver at palladion.com
Fri May 27 09:04:30 EDT 2005


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

Modified Files:
      Tag: Zope-2_7-branch
	testKeywordIndex.py 
Log Message:

 
   - Collector #889:  made 'and' operator for KeywordIndexes actually
     restrict results as expected (thanks to 'aroda' for the patch!).


=== Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py 1.6.12.1 => 1.6.12.2 ===
--- Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py:1.6.12.1	Fri Apr 23 10:29:25 2004
+++ Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py	Fri May 27 09:03:50 2005
@@ -219,6 +219,33 @@
         finally:
             self._ignore_log_errors()
 
+    def testCollectorIssue889(self) :
+        # Test that collector issue 889 is solved
+        values = self._values
+        nonexistent = 'foo-bar-baz'
+        self._populateIndex()
+        # make sure key is not indexed
+        result = self._index._index.get(nonexistent, self._marker)
+        assert result is self._marker
+        # patched _apply_index now works as expected
+        record = {'foo' : { 'query'    : [nonexistent]
+                          , 'operator' : 'and'}
+                 }
+        self._checkApply(record, [])
+        record = {'foo' : { 'query'    : [nonexistent, 'a']
+                          , 'operator' : 'and'}
+                 }
+        # and does not break anything
+        self._checkApply(record, [])
+        record = {'foo' : { 'query'    : ['d']
+                          , 'operator' : 'and'}
+                 }
+        self._checkApply(record, values[4:5])
+        record = {'foo' : { 'query'    : ['a', 'e']
+                          , 'operator' : 'and'}
+                 }
+        self._checkApply(record, values[5:7])
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( TestKeywordIndex ) )



More information about the Zope-Checkins mailing list