[Zope-Checkins] CVS: Zope2 - testUnKeywordIndex.py:1.1.4.4

chrism@serenade.digicool.com chrism@serenade.digicool.com
Wed, 11 Apr 2001 14:51:04 -0400


Update of /cvs-repository/Zope2/lib/python/SearchIndex/tests
In directory serenade.digicool.com:/home/chrism/sandboxes/2_3Branch/lib/python/SearchIndex/tests

Modified Files:
      Tag: zope-2_3-branch
	testUnKeywordIndex.py 
Log Message:
Merging tests for reindexing into branch.



--- Updated File testUnKeywordIndex.py in package Zope2 --
--- testUnKeywordIndex.py	2001/03/28 22:19:57	1.1.4.3
+++ testUnKeywordIndex.py	2001/04/11 18:51:03	1.1.4.4
@@ -219,6 +219,35 @@
         self._checkApply( self._zero_req, values[ -1: ] )
         assert 0 in self._index.uniqueValues( 'foo' )
 
+    def testReindexChange(self):
+        self._populateIndex()
+        expected = Dummy(['x', 'y'])
+        self._index.index_object(6, expected)
+        result, used = self._index._apply_index({'foo': ['x', 'y']})
+        result=result.keys()
+        assert len(result) == 1
+        assert result[0] == 6
+        result, used = self._index._apply_index(
+            {'foo': ['a', 'b', 'c', 'e', 'f']}
+            )
+        result = result.keys()
+        assert 6 not in result
+        
+    def testReindexNoChange(self):
+        self._populateIndex()
+        expected = Dummy(['foo', 'bar'])
+        self._index.index_object(8, expected)
+        result, used = self._index._apply_index(
+            {'foo': ['foo', 'bar']})
+        result = result.keys()
+        assert len(result) == 1
+        assert result[0] == 8
+        self._index.index_object(8, expected)
+        result, used = self._index._apply_index(
+            {'foo': ['foo', 'bar']})
+        result = result.keys()
+        assert len(result) == 1
+        assert result[0] == 8
 
 def test_suite():
     return unittest.makeSuite( TestCase )