[Zope-CVS] CVS: Products/ZCTextIndex/tests - test_index.py:1.1.2.2

Fred L. Drake, Jr. fdrake@acm.org
Tue, 30 Apr 2002 16:24:18 -0400


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

Modified Files:
      Tag: TextIndexDS9-branch
	test_index.py 
Log Message:
First portion of new index.

=== Products/ZCTextIndex/tests/test_index.py 1.1.2.1 => 1.1.2.2 ===
         self.index = Index(self.lexicon, "text")
 
-    def test_index_document(self):
+    def test_index_document(self, DOCID=1):
         doc = Indexable("this is a simple document")
-        DOCID = 1
         self.index.index_object(DOCID, doc)
         self.assert_(self.index._docweight[DOCID])
         self.assertEqual(len(self.index._wordinfo), 5)
@@ -67,6 +66,14 @@
             self.assertEqual(docfreq, 1)
             self.assertEqual(len(map), 1)
             self.assert_(map.has_key(DOCID))
+
+    def test_unindex_document(self):
+        DOCID = 1
+        self.test_index_document(DOCID)
+        self.index.unindex_object(DOCID)
+        self.assertEqual(len(self.index._docweight), 0)
+        self.assertEqual(len(self.index._wordinfo), 0)
+        self.assertEqual(len(self.index._docwords), 0)
 
 
 def test_suite():