[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndex/tests - testSplitter.py:1.9 testTextIndex.py:1.8

Martijn Pieters mj@zope.com
Wed, 14 Aug 2002 18:20:05 -0400


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv24540/TextIndex/tests

Modified Files:
	testSplitter.py testTextIndex.py 
Log Message:
Clean up indentation and trailing whitespace.


=== Zope/lib/python/Products/PluginIndexes/TextIndex/tests/testSplitter.py 1.8 => 1.9 ===
--- Zope/lib/python/Products/PluginIndexes/TextIndex/tests/testSplitter.py:1.8	Wed Feb 20 11:14:34 2002
+++ Zope/lib/python/Products/PluginIndexes/TextIndex/tests/testSplitter.py	Wed Aug 14 18:19:33 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 
 import os,sys
@@ -29,7 +29,7 @@
         (  'öfters   Österreichische   herüber   Überfall   daß   Ärger   verärgert',
           ['öfters','österreichische','herüber','überfall','daß','ärger','verärgert'])
         )
-        
+
 
         pass
 
@@ -37,22 +37,22 @@
         """
         """
 
-           
+
     def testAvailableSplitters( self ):
         "Test available splitters"
 
-        assert len(Splitter.availableSplitters) >0 
-        assert len(Splitter.splitterNames)>0 
+        assert len(Splitter.availableSplitters) >0
+        assert len(Splitter.splitterNames)>0
         assert len(Splitter.availableSplitters)==len(Splitter.splitterNames)
 
 
 
     def _test(self,sp_name,text,splitted):
-    
+
         splitter = Splitter.getSplitter(sp_name)
         result = list(splitter(text))
 
-        assert result==splitted, "%s: %s vs %s" % (sp_name,result,splitted) 
+        assert result==splitted, "%s: %s vs %s" % (sp_name,result,splitted)
 
 
 #    def testZopeSplitter(self):
@@ -60,7 +60,7 @@
 #
 #        for text,splitted in self.testdata:
 #            self._test("ZopeSplitter",text,splitted)
-    
+
     def testISOSplitter(self):
         """test ISOSplitter"""
         for text,splitted in self.testdata:
@@ -82,7 +82,7 @@
     unittest.TextTestRunner().run( test_suite() )
 
 if __name__ == '__main__':
-   if len(sys.argv) > 1:
-      globals()[sys.argv[1]]()
-   else:
-      main()
+    if len(sys.argv) > 1:
+        globals()[sys.argv[1]]()
+    else:
+        main()


=== Zope/lib/python/Products/PluginIndexes/TextIndex/tests/testTextIndex.py 1.7 => 1.8 === (433/533 lines abridged)
--- Zope/lib/python/Products/PluginIndexes/TextIndex/tests/testTextIndex.py:1.7	Thu Feb 28 08:43:23 2002
+++ Zope/lib/python/Products/PluginIndexes/TextIndex/tests/testTextIndex.py	Wed Aug 14 18:19:33 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE
-# 
+#
 ##############################################################################
 
 import sys, os, unittest
@@ -31,267 +31,266 @@
 
     def text( self ):
         return self._text
-    
+
     def __str__( self ):
         return '<Dummy: %s>' % self._text
-    
+
     __repr__ = __str__
 
 class Tests(unittest.TestCase):
 
-   def setUp(self):
-       self.index=TextIndex.TextIndex('text')
-       self.doc=Dummy(text='this is the time, when all good zopes')
-       self.old_log_write = zLOG.log_write
-       zLOG.log_write=log_write
-
-
-   def dbopen(self):
-       n = 'fs_tmp__%s' % os.getpid()
-       s = ZODB.FileStorage.FileStorage(n)
-       db=self.db=ZODB.DB(s)
-       self.jar=db.open()
-       if not self.jar.root().has_key('index'):
-           self.jar.root()['index']=TextIndex.TextIndex('text')
-           get_transaction().commit()
-       return self.jar.root()['index']
-

[-=- -=- -=- 433 lines omitted -=- -=- -=-]

+        self.globTest({'text':u'time and not country'}, [6,])
+
+    def checkParenMatchingQueryUnicode(self):
+        "Check a query with parens (unicode)"
+        ai = self.globTest({'text':u'(time and country) men'}, [0,])
+
+        r = list(ai({'text':u'(time and not country) or men'})[0].keys())
+        assert  r == [0, 6], r
+
+    def checkTextIndexOperatorQueryUnicode(self):
+        "Check a query with 'operator' in the request (unicode)"
+        self.globTest({'text': {u'query': u'time men', 'operator':'and'}}, [0,])
+
+    def checkNonExistentWordUnicode(self):
+        """ Check for nonexistent word  (unicode)"""
+        self.globTest({'text':u'zop'}, [])
+
+    def checkComplexQuery1Unicode(self):
+        """ Check complex query 1  (unicode)"""
+        self.globTest({'text':u'((?ount* or get) and not wait) '
+                       '"been *ert*"'}, [0, 1, 5, 6])
+
 
 def test_suite():
-   return unittest.makeSuite(Tests, 'check')
+    return unittest.makeSuite(Tests, 'check')
 
 def main():
-   unittest.TextTestRunner().run(test_suite())
+    unittest.TextTestRunner().run(test_suite())
 
 def debug():
-   test_suite().debug()
+    test_suite().debug()
 
 def pdebug():
     import pdb
     pdb.run('debug()')
-   
-if __name__=='__main__':
-   if len(sys.argv) > 1:
-      globals()[sys.argv[1]]()
-   else:
-      main()
 
+if __name__=='__main__':
+    if len(sys.argv) > 1:
+        globals()[sys.argv[1]]()
+    else:
+        main()