[Zope-Checkins]
CVS: Zope/lib/python/Products/PluginIndexes/TopicIndex/tests
- testTopicIndex.py:1.6
Andreas Jung
andreas at andreas-jung.com
Sat Aug 16 13:44:55 EDT 2003
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TopicIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv13074/lib/python/Products/PluginIndexes/TopicIndex/tests
Modified Files:
testTopicIndex.py
Log Message:
- PathIndex and TopicIndex are now using a counter for the number
of indexed objects instead of using a very expensive calculation
based on the keys of their indexes.
=== Zope/lib/python/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py 1.5 => 1.6 ===
--- Zope/lib/python/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py:1.5 Thu Nov 28 11:32:02 2002
+++ Zope/lib/python/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py Sat Aug 16 12:44:51 2003
@@ -11,23 +11,20 @@
#
##############################################################################
+import os ,sys, re, unittest
import ZODB
-import os,sys,re,unittest
from Products.PluginIndexes.TopicIndex.TopicIndex import TopicIndex
-
class Obj:
def __init__(self,id,meta_type=''):
- self.id = id
+ self.id = id
self.meta_type = meta_type
def getId(self): return self.id
def getPhysicalPath(self): return self.id
-
-
class TestBase(unittest.TestCase):
def _searchAnd(self,query,expected):
@@ -36,19 +33,15 @@
def _searchOr(self,query,expected):
return self._search(query,'or',expected)
-
def _search(self,query,operator,expected):
res = self.TI._apply_index({'topic':{'query':query,'operator':operator}})
rows = list(res[0])
rows.sort()
expected.sort()
-
self.assertEqual(rows,expected,query)
-
return rows
-
class TestTopicIndex(TestBase):
def setUp(self):
@@ -66,7 +59,6 @@
def testOr(self):
-
self._searchOr('doc1',[1,2])
self._searchOr(['doc1'],[1,2])
self._searchOr('doc2',[3,4]),
@@ -75,14 +67,11 @@
def testAnd(self):
-
self._searchAnd('doc1',[1,2])
self._searchAnd(['doc1'],[1,2])
self._searchAnd('doc2',[3,4])
self._searchAnd(['doc2'],[3,4])
self._searchAnd(['doc1','doc2'],[])
-
-
def test_suite():
More information about the Zope-Checkins
mailing list