diff --git a/tests/keywords.py b/tests/keywords.py index c88a8837..d4f3891a 100644 --- a/tests/keywords.py +++ b/tests/keywords.py @@ -6,7 +6,6 @@ class Keywords: purposes only """ - def __init__(self): self.kw = [] @@ -16,7 +15,8 @@ def build(self,mbox,limit): msg = mb.next() while msg and len(self.kw) < limit: - sub = string.split( msg.dict.get("subject") , ' ') + + sub = msg.dict.get("subject","").split(' ') for f in sub: ok = 1 for c in f: @@ -38,4 +38,11 @@ def keywords(self): return self.kw + + +if __name__=="__main__": + + k = Keywords() + k.build("/home/andreas/zope.mbox",1000) + diff --git a/tests/testCatalog.py b/tests/testCatalog.py index 72f6fa54..a5027ce6 100755 --- a/tests/testCatalog.py +++ b/tests/testCatalog.py @@ -2,11 +2,14 @@ """ Testsuite for testing Catalogs - $Id: testCatalog.py,v 1.5 2001/04/17 17:08:13 chrism Exp $ + $Id: testCatalog.py,v 1.6 2001/06/15 14:09:57 andreas Exp $ Andreas Jung, andreas@digicool.com $Log: testCatalog.py,v $ + Revision 1.6 2001/06/15 14:09:57 andreas + some tweaks for Python 2.1, new ZCatalog/PluginIndexes infrastructure + Revision 1.5 2001/04/17 17:08:13 chrism Merging into trunk. @@ -102,7 +105,7 @@ import Zope import ZODB, ZODB.FileStorage -from Products.ZCatalog import Catalog,ZCatalog,Vocabulary +from Products.ZCatalog import ZCatalog,Vocabulary from Products.ZCatalog.Catalog import CatalogError import Persistence import ExtensionClass @@ -110,10 +113,6 @@ import keywords from zLOG import LOG -from SearchIndex.UnIndex import UnIndex -from SearchIndex.UnTextIndex import UnTextIndex -from SearchIndex.UnKeywordIndex import UnKeywordIndex -from SearchIndex.Lexicon import Lexicon import getopt,whrandom,time,string,mailbox,rfc822 from Testing import unittest @@ -181,7 +180,7 @@ def __init__(self,mboxname,maxfiles): self._vocabulary = Vocabulary.Vocabulary('Vocabulary', 'Vocabulary', globbing=1) - self._catalog = Catalog.Catalog() + self._catalog = ZCatalog.ZCatalog("zcatalog") self._catalog.addIndex('to', 'TextIndex') self._catalog.addIndex('sender', 'TextIndex') self._catalog.addIndex('subject', 'TextIndex') @@ -502,7 +501,7 @@ def funcKeywordRangeIndex(self,*args): for i in range(len(self.keywords)): m = whrandom.randint(0,10000) n = m + 200 - rg.append(m,n) + rg.append( (m,n) ) env = self.th_setup() @@ -532,6 +531,7 @@ def funcUpdates(self,*args,**kw): uncat_conflicts = cat_conflicts = 0 cat,msg_ids = self.get_catalog() + msgs = self.setupUpdatesMethod(kw["numUpdates"]) keys = msgs.keys() @@ -548,7 +548,7 @@ def funcUpdates(self,*args,**kw): obj = msgs[mid] try: - cat.uncatalogObject(mid) + cat.uncatalog_object(mid) if kw.get("commit",1)==1: get_transaction().commit() @@ -557,7 +557,7 @@ def funcUpdates(self,*args,**kw): uncat_conflicts = uncat_conflicts + 1 try: - cat.catalogObject(obj,mid) + cat.catalog_object(obj,mid) if kw.get("commit",1)==1: get_transaction().commit() @@ -589,12 +589,13 @@ def setupUpdatesMethod(self,numUpdates): while msg and i