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
7f85c614
Commit
7f85c614
authored
Nov 26, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added more tests for complex searches
parent
4336f1fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
...n/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
+38
-3
No files found.
lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
View file @
7f85c614
...
...
@@ -164,7 +164,7 @@ class TestCase( unittest.TestCase ):
assert
len
(
self
.
_index
.
_unindex
)
==
0
def
test
PopulateIndex
(
self
):
def
test
SimpleTests
(
self
):
self
.
_populateIndex
()
...
...
@@ -186,14 +186,49 @@ class TestCase( unittest.TestCase ):
res
=
self
.
_index
.
_apply_index
(
{
"path"
:{
'query'
:
path
,
"level"
:
level
}})
lst
=
list
(
res
[
0
].
keys
())
assert
lst
==
results
,
res
self
.
assertEqual
(
lst
,
results
)
for
comp
,
level
,
results
in
tests
:
for
path
in
[
comp
,
"/"
+
comp
,
"/"
+
comp
+
"/"
]:
res
=
self
.
_index
.
_apply_index
(
{
"path"
:{
'query'
:(
(
path
,
level
),)}})
lst
=
list
(
res
[
0
].
keys
())
assert
lst
==
results
,
res
self
.
assertEqual
(
lst
,
results
)
def
testComplexOrTests
(
self
):
self
.
_populateIndex
()
tests
=
[
([
'aa'
,
'bb'
],
1
,[
1
,
2
,
3
,
4
,
5
,
6
,
10
,
11
,
12
,
13
,
14
,
15
]),
([(
'cc'
,
1
),(
'cc'
,
2
)],
0
,[
3
,
6
,
7
,
8
,
9
,
12
,
15
,
16
,
17
,
18
]),
]
for
lst
,
level
,
results
in
tests
:
res
=
self
.
_index
.
_apply_index
(
{
"path"
:{
'query'
:
lst
,
"level"
:
level
,
"operator"
:
"or"
}})
lst
=
list
(
res
[
0
].
keys
())
self
.
assertEqual
(
lst
,
results
)
def
testComplexANDTests
(
self
):
self
.
_populateIndex
()
tests
=
[
([
'aa'
,
'bb'
],
1
,[]),
([(
'aa'
,
0
),(
'bb'
,
1
)],
0
,[
4
,
5
,
6
]),
([(
'aa'
,
0
),(
'cc'
,
2
)],
0
,[
3
,
6
,
9
]),
]
for
lst
,
level
,
results
in
tests
:
res
=
self
.
_index
.
_apply_index
(
{
"path"
:{
'query'
:
lst
,
"level"
:
level
,
"operator"
:
"and"
}})
lst
=
list
(
res
[
0
].
keys
())
self
.
assertEqual
(
lst
,
results
)
def
test_suite
():
return
unittest
.
makeSuite
(
TestCase
)
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