[Zope-CVS] CVS: Products/ZCTextIndex/tests - testIndex.py:1.1.2.8 testZCTextIndex.py:1.1.2.12
Jeremy Hylton
jeremy@zope.com
Mon, 6 May 2002 13:01:24 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv2072/tests
Modified Files:
Tag: TextIndexDS9-branch
testIndex.py testZCTextIndex.py
Log Message:
Refactor storage of undo info; add two helper methods.
The refactoring affects a bunch of the tests, which depended on
the implementation details of _docwords.
When a particular wordinfo map gets small, switch back to a dict.
Add docstring to length() method of Index.
=== Products/ZCTextIndex/tests/testIndex.py 1.1.2.7 => 1.1.2.8 ===
self.assertEqual(len(self.index._wordinfo), 5)
self.assertEqual(len(self.index._docwords), 1)
- self.assertEqual(len(self.index._docwords[DOCID]), 5)
+ self.assertEqual(len(self.index._get_undoinfo(DOCID)), 5)
for map in self.index._wordinfo.values():
self.assertEqual(len(map), 1)
self.assert_(map.has_key(DOCID))
@@ -73,7 +73,7 @@
self.assert_(self.index._docweight[DOCID])
self.assertEqual(len(self.index._wordinfo), 8)
self.assertEqual(len(self.index._docwords), 2)
- self.assertEqual(len(self.index._docwords[DOCID]), 4)
+ self.assertEqual(len(self.index._get_undoinfo(DOCID)), 4)
wids = self.lexicon.termToWordIds("document")
self.assertEqual(len(wids), 1)
document_wid = wids[0]
@@ -94,7 +94,7 @@
self.assert_(self.index._docweight[DOCID])
self.assertEqual(len(self.index._wordinfo), 4)
self.assertEqual(len(self.index._docwords), 1)
- self.assertEqual(len(self.index._docwords[DOCID]), 4)
+ self.assertEqual(len(self.index._get_undoinfo(DOCID)), 4)
for map in self.index._wordinfo.values():
self.assertEqual(len(map), 1)
self.assert_(map.has_key(DOCID))
@@ -105,7 +105,7 @@
self.assert_(self.index._docweight[DOCID])
self.assertEqual(len(self.index._wordinfo), 5)
self.assertEqual(len(self.index._docwords), 1)
- self.assertEqual(len(self.index._docwords[DOCID]), 5)
+ self.assertEqual(len(self.index._get_undoinfo(DOCID)), 5)
wids = self.lexicon.termToWordIds("repeat")
self.assertEqual(len(wids), 1)
repititive_wid = wids[0]
=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.1.2.11 => 1.1.2.12 ===
wids = self.lexicon.termToWordIds(word)
self.assertEqual(wids, [])
- self.assertEqual(len(self.index._docwords[1]), 1)
+ self.assertEqual(len(self.index._get_undoinfo(1)), 1)
def testRanking(self):
# A fairly involved test of the ranking calculations based on