[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests - testTextIndexNG.py:1.1.2.3
Andreas Jung
andreas@digicool.com
Wed, 6 Feb 2002 10:44:33 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests
In directory cvs.zope.org:/tmp/cvs-serv10665/tests
Modified Files:
Tag: ajung-textindexng-branch
testTextIndexNG.py
Log Message:
- code cleanup
- added tests for combined queries
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests/testTextIndexNG.py 1.1.2.2 => 1.1.2.3 ===
from Products.PluginIndexes.TextIndexNG import TextIndexNG
-from Products.PluginIndexes.TextIndexNG import TextIndexCommon
-
-TextIndexCommon._debug = 0
+verbose = 0
+timed_statistics = 0
class TO:
@@ -32,17 +31,23 @@
setattr(self,k,v)
-
class Tests(unittest.TestCase):
_testdata = (
- (1,'this text is a simple text'),
- (2,'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG')
+ (1, 'this text is a simple text'),
+ (2, 'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG'),
+ (3, 'auf einen alle Flugplätze der Gegner zerstört worden'),
+ (4, 'alle Flugplätze Gegner lazy'),
)
def _init(self, arguments):
- self._index = TextIndexNG.TextIndexNG(id='text', extra=arguments)
+ self._index = TextIndexNG.TextIndexNG(
+ id='text',
+ extra=arguments,
+ verbose=verbose,
+ timed_statistics=timed_statistics
+ )
for id,text in self._testdata:
obj = TO (text,id)
@@ -59,7 +64,8 @@
expected_lst = list(expected)
expected_lst.sort()
- self.assertEqual( lst, expected_lst , (query, expected))
+ self.assertEqual( lst, expected_lst , \
+ 'Query: "%s", got: %s, expected: %s' % (query, lst, expected))
return lst
@@ -106,6 +112,18 @@
self.search('br*', [2] )
self.search('QU*', [2] )
self.search('BR*', [2] )
+
+
+ def testCombinedQueriesGlobbingOff(self):
+
+ self._init(arguments(
+ splitterCasefolding = 1,
+ useGlobbing = 0,
+ ))
+
+ self.search('simple and text', [1] )
+ self.search('lazy or alle', [2,3,4] )
+ self.search('alle and sucks', [] )