[Zope-Checkins] SVN: Zope/branches/tyam-unicodeSplitterPatch/src/Products/ZCTextIndex/tests/testLexicon.py Adding two tests for an additional hook on Lexicon.py.

Takeshi Yamamoto tyam at mac.com
Fri Oct 2 06:28:47 EDT 2009


Log message for revision 104742:
  Adding two tests for an additional hook on Lexicon.py.

Changed:
  U   Zope/branches/tyam-unicodeSplitterPatch/src/Products/ZCTextIndex/tests/testLexicon.py

-=-
Modified: Zope/branches/tyam-unicodeSplitterPatch/src/Products/ZCTextIndex/tests/testLexicon.py
===================================================================
--- Zope/branches/tyam-unicodeSplitterPatch/src/Products/ZCTextIndex/tests/testLexicon.py	2009-10-02 10:25:08 UTC (rev 104741)
+++ Zope/branches/tyam-unicodeSplitterPatch/src/Products/ZCTextIndex/tests/testLexicon.py	2009-10-02 10:28:47 UTC (rev 104742)
@@ -94,6 +94,28 @@
         wids = lexicon.termToWordIds('boxes')
         self.assertEqual(wids, [0])
 
+    def testTermToWordIdsWithProcess_post_glob(self):
+        """This test is for added process_post_grob"""
+        class AddedSplitter(Splitter):
+            def process_post_glob(self, lst):
+                assert lst == ['dogs']
+                return ['dogs']
+        lexicon = Lexicon(AddedSplitter())
+        wids = lexicon.sourceToWordIds('cats and dogs')
+        wids = lexicon.termToWordIds('dogs')
+        self.assertEqual(wids, [3])
+
+    def testMissingTermToWordIdsWithProcess_post_glob(self):
+        """This test is for added process_post_grob"""
+        class AddedSplitter(Splitter):
+            def process_post_glob(self, lst):
+                assert lst == ['dogs']
+                return ['fox']
+        lexicon = Lexicon(AddedSplitter())
+        wids = lexicon.sourceToWordIds('cats and dogs')
+        wids = lexicon.termToWordIds('dogs')
+        self.assertEqual(wids, [0])
+
     def testOnePipelineElement(self):
         lexicon = Lexicon(Splitter(), StupidPipelineElement('dogs', 'fish'))
         wids = lexicon.sourceToWordIds('cats and dogs')



More information about the Zope-Checkins mailing list