[Zope-CVS] CVS: Products/ZCTextIndex/tests - testQueryEngine.py:1.1.2.6 testZCTextIndex.py:1.1.2.13

Guido van Rossum guido@python.org
Mon, 6 May 2002 13:05:35 -0400


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

Modified Files:
      Tag: TextIndexDS9-branch
	testQueryEngine.py testZCTextIndex.py 
Log Message:
More refactoring: move the query engine functionality into the parse
tree node implementation.  (The query engine test remains, to test
this functionality in the parse tree.)


=== Products/ZCTextIndex/tests/testQueryEngine.py 1.1.2.5 => 1.1.2.6 ===
 
 from Products.ZCTextIndex.QueryParser import QueryParser
-from Products.ZCTextIndex.ParseTree import ParseError
-from Products.ZCTextIndex.QueryEngine import QueryEngine, QueryError
+from Products.ZCTextIndex.ParseTree import ParseError, QueryError
 
 class FauxIndex:
 
@@ -36,7 +35,6 @@
 
     def setUp(self):
         self.parser = QueryParser()
-        self.engine = QueryEngine()
         self.index = FauxIndex()
 
     def compareSet(self, set, dict):
@@ -47,7 +45,7 @@
 
     def compareQuery(self, query, dict):
         tree = self.parser.parseQuery(query)
-        set = self.engine.executeQuery(self.index, tree)
+        set = tree.executeQuery(self.index)
         self.compareSet(set, dict)
 
     def testExecuteQuery(self):
@@ -63,8 +61,7 @@
     def testInvalidQuery(self):
         from Products.ZCTextIndex.ParseTree import NotNode, AtomNode
         tree = NotNode(AtomNode("foo"))
-        self.assertRaises(QueryError,
-                          self.engine.executeQuery, self.index, tree)
+        self.assertRaises(QueryError, tree.executeQuery, self.index)
 
 def test_suite():
     return makeSuite(TestQueryEngine)


=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.1.2.12 => 1.1.2.13 ===
         self.zc_index = ZCTextIndex()
         self.p = self.parser = self.zc_index.parser
-        self.engine = self.zc_index.engine
         self.index = self.zc_index.index
         self.add_docs()