[Zope-CVS] CVS: Products/ZCTextIndex/tests - testIndex.py:1.1.2.2
Fred L. Drake, Jr.
fdrake@acm.org
Wed, 1 May 2002 12:00:32 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv16797/tests
Modified Files:
Tag: TextIndexDS9-branch
testIndex.py
Log Message:
Simplify data structures: the values in _wordinfo can just be the map; the
number-of-docs-with-word-in-corpus will always be the same as the length
of the map.
=== Products/ZCTextIndex/tests/testIndex.py 1.1.2.1 => 1.1.2.2 ===
self.assertEqual(len(self.index._docwords), 1)
self.assertEqual(len(self.index._docwords[DOCID]), 5)
- for docfreq, map in self.index._wordinfo.values():
- self.assertEqual(docfreq, 1)
+ for map in self.index._wordinfo.values():
self.assertEqual(len(map), 1)
self.assert_(map.has_key(DOCID))
@@ -90,14 +89,12 @@
self.assertEqual(len(self.index._docwords), 2)
self.assertEqual(len(self.index._docwords[DOCID]), 4)
document_wid = self.lexicon._words["document"]
- for wid, (docfreq, map) in self.index._wordinfo.items():
+ for wid, map in self.index._wordinfo.items():
if wid == document_wid:
- self.assertEqual(docfreq, 2)
self.assertEqual(len(map), 2)
self.assert_(map.has_key(1))
self.assert_(map.has_key(DOCID))
else:
- self.assertEqual(docfreq, 1)
self.assertEqual(len(map), 1)
def test_index_two_unindex_one(self):
@@ -110,8 +107,7 @@
self.assertEqual(len(self.index._wordinfo), 4)
self.assertEqual(len(self.index._docwords), 1)
self.assertEqual(len(self.index._docwords[DOCID]), 4)
- for docfreq, map in self.index._wordinfo.values():
- self.assertEqual(docfreq, 1)
+ for map in self.index._wordinfo.values():
self.assertEqual(len(map), 1)
self.assert_(map.has_key(DOCID))
@@ -123,11 +119,7 @@
self.assertEqual(len(self.index._docwords), 1)
self.assertEqual(len(self.index._docwords[DOCID]), 5)
repititive_wid = self.lexicon._words["repititive"]
- for wid, (docfreq, map) in self.index._wordinfo.items():
- if wid == repititive_wid:
- self.assertEqual(docfreq, 1)
- else:
- self.assertEqual(docfreq, 1)
+ for wid, map in self.index._wordinfo.items():
self.assertEqual(len(map), 1)
self.assert_(map.has_key(DOCID))