[Zope-CVS] CVS: Products/ZCTextIndex/tests - testZCTextIndex.py:1.1.2.3

Jeremy Hylton jeremy@zope.com
Thu, 2 May 2002 12:50:39 -0400


Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv20071/tests

Modified Files:
      Tag: TextIndexDS9-branch
	testZCTextIndex.py 
Log Message:
Add a test of the stopwords


=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.1.2.2 => 1.1.2.3 ===
         self.lexicon = self.zc_index.lexicon
 
+    def testStopWords(self):
+        # the only non-stopword is question
+        text = ("to be or not to be "
+                "that is the question")
+        doc = testIndex.Indexable(text)
+        self.zc_index.index_object(1, doc)
+        for word in text.split():
+            if word != "question":
+                wids = self.lexicon.termToWordIds(word)
+                self.assertEqual(wids, [])
+        self.assertEqual(len(self.index._docwords[1]), 1)
+
 class QueryTests(testQueryEngine.TestQueryEngine,
                  testQueryParser.TestQueryParser):