[Zope3-checkins] CVS: Zope3/lib/python/Zope/TextIndex/tests - testTextIndexWrapper.py:1.3
Guido van Rossum
guido@python.org
Thu, 5 Dec 2002 07:41:09 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/TextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv17380/tests
Modified Files:
testTextIndexWrapper.py
Log Message:
Fix division by zero on globbing query.
Add unit tests for that, and for default values of batching parameters.
=== Zope3/lib/python/Zope/TextIndex/tests/testTextIndexWrapper.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/TextIndex/tests/testTextIndexWrapper.py:1.2 Wed Dec 4 03:32:19 2002
+++ Zope3/lib/python/Zope/TextIndex/tests/testTextIndexWrapper.py Thu Dec 5 07:41:09 2002
@@ -37,6 +37,22 @@
[(docid, rank)] = matches # if this fails there's a problem
self.assertEqual(docid, 1000)
+ def testDefaultBatch(self):
+ matches, total = self.wrapper.query(u"fox", 0)
+ self.assertEqual(total, 2)
+ self.assertEqual(len(matches), 2)
+ matches, total = self.wrapper.query(u"fox")
+ self.assertEqual(total, 2)
+ self.assertEqual(len(matches), 2)
+ matches, total = self.wrapper.query(u" fox", 1)
+ self.assertEqual(total, 2)
+ self.assertEqual(len(matches), 1)
+
+ def testGlobbing(self):
+ matches, total = self.wrapper.query("fo*")
+ self.assertEqual(total, 2)
+ self.assertEqual(len(matches), 2)
+
def testLatin1(self):
w = self.wrapper
doc = u"Fran\xe7ois"