[Zope-Checkins] CVS: Zope2 - testUnKeywordIndex.py:1.1.4.3.2.1
chrism@serenade.digicool.com
chrism@serenade.digicool.com
Wed, 11 Apr 2001 00:23:20 -0400
Update of /cvs-repository/Zope2/lib/python/SearchIndex/tests
In directory serenade.digicool.com:/home/chrism/sandboxes/CatalogForNow/lib/python/SearchIndex/tests
Modified Files:
Tag: chrism-CatalogForNow-branch
testUnKeywordIndex.py
Log Message:
Added reindexing tests.
--- Updated File testUnKeywordIndex.py in package Zope2 --
--- testUnKeywordIndex.py 2001/03/28 22:19:57 1.1.4.3
+++ testUnKeywordIndex.py 2001/04/11 04:23:19 1.1.4.3.2.1
@@ -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 )