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
de96d020
Commit
de96d020
authored
Aug 01, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder catalog tests and note methods with missing coverage
parent
8211b317
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
68 deletions
+86
-68
src/Products/ZCatalog/tests/test_catalog.py
src/Products/ZCatalog/tests/test_catalog.py
+86
-68
No files found.
src/Products/ZCatalog/tests/test_catalog.py
View file @
de96d020
...
@@ -167,7 +167,7 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
...
@@ -167,7 +167,7 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
'del index failed'
)
'del index failed'
)
class
TestCatalog
Object
(
CatalogBase
,
unittest
.
TestCase
):
class
TestCatalog
(
CatalogBase
,
unittest
.
TestCase
):
upper
=
1000
upper
=
1000
...
@@ -217,6 +217,84 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
...
@@ -217,6 +217,84 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
_catalog
=
None
self
.
_catalog
=
None
# clear
# updateBrains
# __getitem__
# __setstate__
# useBrains
# getIndex
# updateMetadata
def
testCatalogObjectUpdateMetadataFalse
(
self
):
ob
=
dummy
(
9999
)
self
.
_catalog
.
catalogObject
(
ob
,
`9999`
)
brain
=
self
.
_catalog
(
num
=
9999
)[
0
]
self
.
assertEqual
(
brain
.
att1
,
'att1'
)
ob
.
att1
=
'foobar'
self
.
_catalog
.
catalogObject
(
ob
,
`9999`
,
update_metadata
=
0
)
brain
=
self
.
_catalog
(
num
=
9999
)[
0
]
self
.
assertEqual
(
brain
.
att1
,
'att1'
)
self
.
_catalog
.
catalogObject
(
ob
,
`9999`
)
brain
=
self
.
_catalog
(
num
=
9999
)[
0
]
self
.
assertEqual
(
brain
.
att1
,
'foobar'
)
def
uncatalog
(
self
):
for
x
in
range
(
0
,
self
.
upper
):
self
.
_catalog
.
uncatalogObject
(
`x`
)
def
testUncatalogFieldIndex
(
self
):
self
.
uncatalog
()
a
=
self
.
_catalog
(
att1
=
'att1'
)
self
.
assertEqual
(
len
(
a
),
0
,
'len: %s'
%
len
(
a
))
def
testUncatalogTextIndex
(
self
):
self
.
uncatalog
()
a
=
self
.
_catalog
(
att2
=
'att2'
)
self
.
assertEqual
(
len
(
a
),
0
,
'len: %s'
%
len
(
a
))
def
testUncatalogKeywordIndex
(
self
):
self
.
uncatalog
()
a
=
self
.
_catalog
(
att3
=
'att3'
)
self
.
assertEqual
(
len
(
a
),
0
,
'len: %s'
%
len
(
a
))
def
testBadUncatalog
(
self
):
try
:
self
.
_catalog
.
uncatalogObject
(
'asdasdasd'
)
except
Exception
:
self
.
fail
(
'uncatalogObject raised exception on bad uid'
)
def
testUncatalogTwice
(
self
):
self
.
_catalog
.
uncatalogObject
(
`0`
)
def
_second
(
self
):
self
.
_catalog
.
uncatalogObject
(
`0`
)
self
.
assertRaises
(
Exception
,
_second
)
def
testCatalogLength
(
self
):
for
x
in
range
(
0
,
self
.
upper
):
self
.
_catalog
.
uncatalogObject
(
`x`
)
self
.
assertEqual
(
len
(
self
.
_catalog
),
0
)
def
testUniqueValuesForLength
(
self
):
a
=
self
.
_catalog
.
uniqueValuesFor
(
'att1'
)
self
.
assertEqual
(
len
(
a
),
1
,
'bad number of unique values %s'
%
a
)
def
testUniqueValuesForContent
(
self
):
a
=
self
.
_catalog
.
uniqueValuesFor
(
'att1'
)
self
.
assertEqual
(
a
[
0
],
'att1'
,
'bad content %s'
%
a
[
0
])
# hasuid
# recordify
# instantiate
# getMetadataForRID
# getIndexDataForRID
# make_query
# _sorted_search_indexes
# search
# sortResults
# _get_sort_attr
# _getSortIndex
# searchResults
def
testResultLength
(
self
):
def
testResultLength
(
self
):
a
=
self
.
_catalog
(
att1
=
'att1'
)
a
=
self
.
_catalog
(
att1
=
'att1'
)
self
.
assertEqual
(
len
(
a
),
self
.
upper
,
self
.
assertEqual
(
len
(
a
),
self
.
upper
,
...
@@ -254,51 +332,6 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
...
@@ -254,51 +332,6 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
self
.
assertEqual
(
len
(
a
),
self
.
upper
,
self
.
assertEqual
(
len
(
a
),
self
.
upper
,
'should be %s, but is %s'
%
(
self
.
upper
,
len
(
a
)))
'should be %s, but is %s'
%
(
self
.
upper
,
len
(
a
)))
def
testUncatalogFieldIndex
(
self
):
self
.
uncatalog
()
a
=
self
.
_catalog
(
att1
=
'att1'
)
self
.
assertEqual
(
len
(
a
),
0
,
'len: %s'
%
len
(
a
))
def
testUncatalogTextIndex
(
self
):
self
.
uncatalog
()
a
=
self
.
_catalog
(
att2
=
'att2'
)
self
.
assertEqual
(
len
(
a
),
0
,
'len: %s'
%
len
(
a
))
def
testUncatalogKeywordIndex
(
self
):
self
.
uncatalog
()
a
=
self
.
_catalog
(
att3
=
'att3'
)
self
.
assertEqual
(
len
(
a
),
0
,
'len: %s'
%
len
(
a
))
def
testBadUncatalog
(
self
):
try
:
self
.
_catalog
.
uncatalogObject
(
'asdasdasd'
)
except
Exception
:
self
.
fail
(
'uncatalogObject raised exception on bad uid'
)
def
testUniqueValuesForLength
(
self
):
a
=
self
.
_catalog
.
uniqueValuesFor
(
'att1'
)
self
.
assertEqual
(
len
(
a
),
1
,
'bad number of unique values %s'
%
a
)
def
testUniqueValuesForContent
(
self
):
a
=
self
.
_catalog
.
uniqueValuesFor
(
'att1'
)
self
.
assertEqual
(
a
[
0
],
'att1'
,
'bad content %s'
%
a
[
0
])
def
testUncatalogTwice
(
self
):
self
.
_catalog
.
uncatalogObject
(
`0`
)
self
.
assertRaises
(
Exception
,
'_second'
)
def
testCatalogLength
(
self
):
for
x
in
range
(
0
,
self
.
upper
):
self
.
_catalog
.
uncatalogObject
(
`x`
)
self
.
assertEqual
(
len
(
self
.
_catalog
),
0
)
def
_second
(
self
):
self
.
_catalog
.
uncatalogObject
(
`0`
)
def
uncatalog
(
self
):
for
x
in
range
(
0
,
self
.
upper
):
self
.
_catalog
.
uncatalogObject
(
`x`
)
def
testGoodSortIndex
(
self
):
def
testGoodSortIndex
(
self
):
upper
=
self
.
upper
upper
=
self
.
upper
a
=
self
.
_catalog
(
att1
=
'att1'
,
sort_on
=
'num'
)
a
=
self
.
_catalog
(
att1
=
'att1'
,
sort_on
=
'num'
)
...
@@ -309,17 +342,15 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
...
@@ -309,17 +342,15 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
def
testBadSortIndex
(
self
):
def
testBadSortIndex
(
self
):
from
Products.ZCatalog.Catalog
import
CatalogError
from
Products.ZCatalog.Catalog
import
CatalogError
self
.
assertRaises
(
CatalogError
,
self
.
badsortindex
)
def
badsortindex
():
self
.
_catalog
(
sort_on
=
'foofaraw'
)
def
badsortindex
(
self
):
self
.
assertRaises
(
CatalogError
,
badsortindex
)
self
.
_catalog
(
sort_on
=
'foofaraw'
)
def
testWrongKindOfIndexForSort
(
self
):
def
testWrongKindOfIndexForSort
(
self
):
from
Products.ZCatalog.Catalog
import
CatalogError
from
Products.ZCatalog.Catalog
import
CatalogError
self
.
assertRaises
(
CatalogError
,
self
.
wrongsortindex
)
def
wrongsortindex
():
self
.
_catalog
(
sort_on
=
'att2'
)
def
wrongsortindex
(
self
):
self
.
assertRaises
(
CatalogError
,
wrongsortindex
)
self
.
_catalog
(
sort_on
=
'att2'
)
def
testTextIndexQWithSortOn
(
self
):
def
testTextIndexQWithSortOn
(
self
):
upper
=
self
.
upper
upper
=
self
.
upper
...
@@ -390,19 +421,6 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
...
@@ -390,19 +421,6 @@ class TestCatalogObject(CatalogBase, unittest.TestCase):
self
.
assertEqual
(
a
.
actual_result_count
,
self
.
upper
)
self
.
assertEqual
(
a
.
actual_result_count
,
self
.
upper
)
self
.
assertEqual
(
a
[
0
].
num
,
self
.
upper
-
1
)
self
.
assertEqual
(
a
[
0
].
num
,
self
.
upper
-
1
)
def
testUpdateMetadataFalse
(
self
):
ob
=
dummy
(
9999
)
self
.
_catalog
.
catalogObject
(
ob
,
`9999`
)
brain
=
self
.
_catalog
(
num
=
9999
)[
0
]
self
.
assertEqual
(
brain
.
att1
,
'att1'
)
ob
.
att1
=
'foobar'
self
.
_catalog
.
catalogObject
(
ob
,
`9999`
,
update_metadata
=
0
)
brain
=
self
.
_catalog
(
num
=
9999
)[
0
]
self
.
assertEqual
(
brain
.
att1
,
'att1'
)
self
.
_catalog
.
catalogObject
(
ob
,
`9999`
)
brain
=
self
.
_catalog
(
num
=
9999
)[
0
]
self
.
assertEqual
(
brain
.
att1
,
'foobar'
)
class
TestRangeSearch
(
CatalogBase
,
unittest
.
TestCase
):
class
TestRangeSearch
(
CatalogBase
,
unittest
.
TestCase
):
...
@@ -577,7 +595,7 @@ def test_suite():
...
@@ -577,7 +595,7 @@ def test_suite():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelIndexes
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelIndexes
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalog
Object
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalog
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestRangeSearch
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestRangeSearch
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalogSearchArgumentsMap
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalogSearchArgumentsMap
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestMergeResults
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestMergeResults
))
...
...
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