[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TopicIndex/tests - testTopicIndex.py:1.4.6.1
Andreas Jung
andreas@andreas-jung.com
Thu, 28 Nov 2002 11:37:05 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TopicIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv6225/tests
Modified Files:
Tag: Zope-2_6-branch
testTopicIndex.py
Log Message:
backport from trunk
=== Zope/lib/python/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py 1.4 => 1.4.6.1 ===
--- Zope/lib/python/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py:1.4 Wed Aug 14 18:19:34 2002
+++ Zope/lib/python/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py Thu Nov 28 11:37:04 2002
@@ -12,10 +12,9 @@
##############################################################################
-import Zope
+import ZODB
import os,sys,re,unittest
from Products.PluginIndexes.TopicIndex.TopicIndex import TopicIndex
-from Products.ZCatalog.ZCatalog import ZCatalog
class Obj:
@@ -84,57 +83,11 @@
self._searchAnd(['doc1','doc2'],[])
-class ZCatalogTopicTests(TestBase):
-
-
- def setUp(self):
-
- self.cat = ZCatalog('catalog')
- self.cat.addColumn('id')
- self.cat.addIndex('topic','TopicIndex')
- self.TI = self.cat._catalog.indexes['topic']
-
- self.TI.addFilteredSet("doc1","PythonFilteredSet","o.meta_type=='doc1'")
- self.TI.addFilteredSet("doc2","PythonFilteredSet","o.meta_type=='doc2'")
-
- self.cat.catalog_object(Obj('0'))
- self.cat.catalog_object(Obj('1','doc1'))
- self.cat.catalog_object(Obj('2','doc1'))
- self.cat.catalog_object(Obj('3','doc2'))
- self.cat.catalog_object(Obj('4','doc2'))
- self.cat.catalog_object(Obj('5','doc3'))
- self.cat.catalog_object(Obj('6','doc3'))
-
- def testOr(self):
-
- self._searchOr('doc1',[1,2])
- self._searchOr('doc2',[3,4])
- self._searchOr(['doc1','doc2'],[1,2,3,4])
-
- def testAnd(self):
-
- self._searchAnd('doc1',[1,2])
- self._searchAnd('doc2',[3,4])
- self._searchAnd(['doc1','doc2'],[])
-
- def _search(self,query,operator,expected):
-
- res = self.cat.searchResults({'topic':{'query':query,'operator':operator}})
-
- rows = [int(x.id) for x in res ]
- rows.sort()
- expected.sort()
-
- self.assertEqual(rows,expected,query)
-
- return rows,res
-
def test_suite():
return unittest.TestSuite( (
unittest.makeSuite(TestTopicIndex),
- unittest.makeSuite(ZCatalogTopicTests),
))