[Zope-CVS] CVS: Products/ZCTextIndex/tests - testZCTextIndex.py:1.1.2.14
Casey Duncan
casey@zope.com
Wed, 8 May 2002 18:17:27 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv2006/tests
Modified Files:
Tag: TextIndexDS9-branch
testZCTextIndex.py
Log Message:
Began integration in Zope
* Changed ZCTextIndex to conform to expected PlugInIndex signature
* Added preliminary management pages
* Updated tests
=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.1.2.13 => 1.1.2.14 ===
+from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex, Splitter, \
+ CaseNormalizer, StopWordRemover
from Products.ZCTextIndex.tests \
import testIndex, testQueryEngine, testQueryParser
from Products.ZCTextIndex.Index import scaled_int, SCALE_FACTOR
+from Products.ZCTextIndex.Lexicon import Lexicon
import unittest
class Indexable:
def __init__(self, text):
self.text = text
+
+class LexiconHolder:
+ def __init__(self, lexicon):
+ self.lexicon = lexicon
+
+class Extra:
+ pass
# The tests classes below create a ZCTextIndex(). Then they create
# instance variables that point to the internal components used by
@@ -21,7 +30,12 @@
class IndexTests(testIndex.IndexTest):
def setUp(self):
- self.zc_index = ZCTextIndex()
+ extra = Extra()
+ extra.doc_attr = 'text'
+ extra.lexicon_id = 'lexicon'
+ caller = LexiconHolder(Lexicon(Splitter(), CaseNormalizer(),
+ StopWordRemover()))
+ self.zc_index = ZCTextIndex(extra, caller)
self.index = self.zc_index.index
self.lexicon = self.zc_index.lexicon
@@ -122,7 +136,12 @@
docs = ["foo bar ham", "bar ham", "foo ham", "ham"]
def setUp(self):
- self.zc_index = ZCTextIndex()
+ extra = Extra()
+ extra.doc_attr = 'text'
+ extra.lexicon_id = 'lexicon'
+ caller = LexiconHolder(Lexicon(Splitter(), CaseNormalizer(),
+ StopWordRemover()))
+ self.zc_index = ZCTextIndex(extra, caller)
self.p = self.parser = self.zc_index.parser
self.index = self.zc_index.index
self.add_docs()