[Zope-CVS] CVS: Products/ZCTextIndex/tests - testLexicon.py:1.1.2.10
Guido van Rossum
guido@python.org
Fri, 3 May 2002 13:18:31 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv12927/tests
Modified Files:
Tag: TextIndexDS9-branch
testLexicon.py
Log Message:
Make the splitter part of the normal pipeline.
Use *args syntax to pass the pipeline elements to the Lexicon.
=== Products/ZCTextIndex/tests/testLexicon.py 1.1.2.9 => 1.1.2.10 ===
#
##############################################################################
-"""
-
-Revision information:
-$Id$
-"""
from unittest import TestCase, TestSuite, main, makeSuite
@@ -84,14 +79,13 @@
self.assertEqual(wids, [])
def testOnePipelineElement(self):
- lexicon = Lexicon(Splitter(),
- (StupidPipelineElement('dogs', 'fish'),),)
+ lexicon = Lexicon(Splitter(), StupidPipelineElement('dogs', 'fish'))
wids = lexicon.sourceToWordIds('cats and dogs')
wids = lexicon.termToWordIds('fish')
self.assertEqual(wids, [3])
def testSplitterAdaptorFold(self):
- lexicon = Lexicon(Splitter(), [CaseNormalizer()])
+ lexicon = Lexicon(Splitter(), CaseNormalizer())
wids = lexicon.sourceToWordIds('CATS and dogs')
wids = lexicon.termToWordIds('cats and dogs')
self.assertEqual(wids, [1, 2, 3])
@@ -104,17 +98,17 @@
def testTwoElementPipeline(self):
lexicon = Lexicon(Splitter(),
- (StupidPipelineElement('cats', 'fish'),
- WackyReversePipelineElement('fish')))
+ StupidPipelineElement('cats', 'fish'),
+ WackyReversePipelineElement('fish'))
wids = lexicon.sourceToWordIds('cats and dogs')
wids = lexicon.termToWordIds('hsif')
self.assertEqual(wids, [1])
def testThreeElementPipeline(self):
lexicon = Lexicon(Splitter(),
- (StopWordPipelineElement({'and':1}),
- StupidPipelineElement('dogs', 'fish'),
- WackyReversePipelineElement('fish')))
+ StopWordPipelineElement({'and':1}),
+ StupidPipelineElement('dogs', 'fish'),
+ WackyReversePipelineElement('fish'))
wids = lexicon.sourceToWordIds('cats and dogs')
wids = lexicon.termToWordIds('hsif')
self.assertEqual(wids, [2])