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
94b452e8
Commit
94b452e8
authored
May 19, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beef up the reindexing tests to check that they actually fail before the
original doc text gets restored.
parent
bd532bbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
7 deletions
+43
-7
lib/python/Products/ZCTextIndex/tests/testZCTextIndex.py
lib/python/Products/ZCTextIndex/tests/testZCTextIndex.py
+43
-7
No files found.
lib/python/Products/ZCTextIndex/tests/testZCTextIndex.py
View file @
94b452e8
...
...
@@ -212,12 +212,33 @@ class CosineIndexTests(ZCIndexTestsBase, testIndex.CosineIndexTest):
self._ranking_idf()
self._ranking_queries()
# A digression to exercise re-indexing. This should leave
# things exactly as they were.
# A digression to exercise re-indexing.
docs = self.docs
for variant in ("
hot
cold
porridge
python
", "
pease
hot
pithy
",
docs[-1]):
for variant in "
hot
cold
porridge
python
", "
pease
hot
pithy
":
self.zc_index.index_object(len(docs), Indexable(variant))
try:
self._ranking_tf()
except (AssertionError, KeyError):
pass
else:
self.fail("
expected
_ranking_tf
()
to
fail
--
reindex
")
try:
self._ranking_idf()
except (AssertionError, KeyError):
pass
else:
self.fail("
expected
_ranking_idf
()
to
fail
--
reindex
")
try:
self._ranking_queries()
except AssertionError:
pass
else:
self.fail("
expected
_ranking_queries
()
to
fail
--
reindex
")
# This should leave things exactly as they were.
self.zc_index.index_object(len(docs), Indexable(docs[-1]))
self._ranking_tf()
self._ranking_idf()
self._ranking_queries()
...
...
@@ -292,9 +313,17 @@ class OkapiIndexTests(ZCIndexTestsBase, testIndex.OkapiIndexTest):
self._checkAbsoluteScores()
# Exercise re-indexing.
This should leave things exactly as they were.
for variant in "
one
xyz
", "
xyz
two
three
", "
abc
def
"
, docs[-1]
:
# Exercise re-indexing.
for variant in "
one
xyz
", "
xyz
two
three
", "
abc
def
":
self.zc_index.index_object(len(docs), Indexable(variant))
try:
self._checkRelativeScores()
except AssertionError:
pass
else:
self.fail("
expected
_checkAbsoluteScores
()
to
fail
--
reindex
")
# This should leave things exactly as they were.
self.zc_index.index_object(len(docs), Indexable(docs[-1]))
self._checkAbsoluteScores()
def _checkAbsoluteScores(self):
...
...
@@ -346,8 +375,15 @@ class OkapiIndexTests(ZCIndexTestsBase, testIndex.OkapiIndexTest):
self.zc_index.index_object(i, Indexable(doc))
self._checkRelativeScores()
# Exercise re-indexing.
This should leave things exactly as they were.
# Exercise re-indexing.
self.zc_index.index_object(9, Indexable("
two
xyz
"))
try:
self._checkRelativeScores()
except AssertionError:
pass
else:
self.fail("
expected
_checkRelativeScores
()
to
fail
after
reindex
")
# This should leave things exactly as they were.
self.zc_index.index_object(9, Indexable(doc))
self._checkRelativeScores()
...
...
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