Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
460e6f36
Commit
460e6f36
authored
Jun 15, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some tweaks for Python 2.1, new ZCatalog/PluginIndexes infrastructure
parent
052a199f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
20 deletions
+33
-20
lib/python/Products/ZCatalog/tests/keywords.py
lib/python/Products/ZCatalog/tests/keywords.py
+9
-2
lib/python/Products/ZCatalog/tests/testCatalog.py
lib/python/Products/ZCatalog/tests/testCatalog.py
+24
-18
No files found.
lib/python/Products/ZCatalog/tests/keywords.py
View file @
460e6f36
...
...
@@ -6,7 +6,6 @@ class Keywords:
purposes only
"""
def
__init__
(
self
):
self
.
kw
=
[]
...
...
@@ -16,7 +15,8 @@ class Keywords:
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 @@ class Keywords:
return
self
.
kw
if
__name__
==
"__main__"
:
k
=
Keywords
()
k
.
build
(
"/home/andreas/zope.mbox"
,
1000
)
lib/python/Products/ZCatalog/tests/testCatalog.py
View file @
460e6f36
...
...
@@ -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 @@ here = os.getcwd()
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 @@ from Testing import dispatcher
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 @@ class testCatalog(Persistence.Persistent,unittest.TestCase):
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 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
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 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
uncat_conflicts
=
cat_conflicts
=
0
cat
,
msg_ids
=
self
.
get_catalog
()
msgs
=
self
.
setupUpdatesMethod
(
kw
[
"numUpdates"
])
keys
=
msgs
.
keys
()
...
...
@@ -548,7 +548,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
obj
=
msgs
[
mid
]
try
:
cat
.
uncatalog
O
bject
(
mid
)
cat
.
uncatalog
_o
bject
(
mid
)
if
kw
.
get
(
"commit"
,
1
)
==
1
:
get_transaction
().
commit
()
...
...
@@ -557,7 +557,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
uncat_conflicts
=
uncat_conflicts
+
1
try
:
cat
.
catalog
O
bject
(
obj
,
mid
)
cat
.
catalog
_o
bject
(
obj
,
mid
)
if
kw
.
get
(
"commit"
,
1
)
==
1
:
get_transaction
().
commit
()
...
...
@@ -589,12 +589,13 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
while
msg
and
i
<
numUpdates
:
obj
=
testMessage
(
msg
)
mid
=
msg
.
dict
[
"message-id"
]
dict
[
mid
]
=
obj
mid
=
msg
.
dict
.
get
(
"message-id"
,
None
)
if
mid
:
dict
[
mid
]
=
obj
i
=
i
+
1
msg
=
mb
.
next
()
i
=
i
+
1
return
dict
...
...
@@ -627,10 +628,15 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
i
=
0
msg
=
mb
.
next
()
while
msg
and
i
<
numfiles
:
obj
=
testMessage
(
msg
,
modify_doc
)
mid
=
msg
.
dict
[
"message-id"
]
if
msg
.
dict
.
has_key
(
"message-id"
):
mid
=
msg
.
dict
[
"message-id"
]
else
:
msg
=
mb
.
next
()
continue
try
:
cat
.
catalogObject
(
obj
,
mid
)
...
...
@@ -1055,10 +1061,10 @@ def get_tests(what):
)
bench2_tests
=
(
testSearches
(
"testReindexing"
,
numThreads
=
1
),
testSearches
(
"testIncrementalIndexing"
,
numThreads
=
1
),
#
testSearches("testReindexing",numThreads=1),
#
testSearches("testIncrementalIndexing",numThreads=1),
testSearches
(
"testUpdates"
,
numThreads
=
2
,
numUpdates
=
200
),
testSearches
(
"testUpdates"
,
numThreads
=
4
,
numUpdates
=
200
)
#
testSearches("testUpdates",numThreads=4,numUpdates=200)
)
exp_tests
=
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment