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

Tres Seaver tseaver at palladion.com
Mon Sep 5 12:54:04 EDT 2005


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

Modified Files:
      Tag: Zope-2_7-branch
	testZCTextIndex.py 
Log Message:


 - Collector #1815: ZCTextIndex.index_object() now handles either
   strings or lists of strings.


=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.37.2.2 => 1.37.2.3 ===
--- Products/ZCTextIndex/tests/testZCTextIndex.py:1.37.2.2	Tue May 17 14:10:41 2005
+++ Products/ZCTextIndex/tests/testZCTextIndex.py	Mon Sep  5 12:54:04 2005
@@ -151,6 +151,29 @@
         nbest, total = zc_index.query('foo alpha gamma')
         self.assertEqual(len(nbest), 0)
 
+    def testListAttributes(self):
+        lexicon = PLexicon('lexicon', '',
+                            Splitter(),
+                            CaseNormalizer(),
+                            StopWordRemover())
+        caller = LexiconHolder(self.lexicon)
+        zc_index = ZCTextIndex('name',
+                                None,
+                                caller,
+                                self.IndexFactory,
+                               'text1,text2',
+                               'lexicon')
+        doc = Indexable2('Hello Tim', \
+                         ['Now is the winter of our discontent',
+                          'Made glorious summer by this sun of York', ])
+        zc_index.index_object(1, doc)
+        nbest, total = zc_index.query('glorious')
+        self.assertEqual(len(nbest), 1)
+        nbest, total = zc_index.query('York Tim')
+        self.assertEqual(len(nbest), 1)
+        nbest, total = zc_index.query('Tuesday Tim York')
+        self.assertEqual(len(nbest), 0)
+
     def testStopWords(self):
         # the only non-stopword is question
         text = ("to be or not to be "



More information about the Zope-Checkins mailing list