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
5069d2f2
Commit
5069d2f2
authored
May 14, 2002
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test cases for the C version of StopWordRemover.
parent
ca38cb41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
lib/python/Products/ZCTextIndex/tests/testStopper.py
lib/python/Products/ZCTextIndex/tests/testStopper.py
+42
-0
No files found.
lib/python/Products/ZCTextIndex/tests/testStopper.py
0 → 100644
View file @
5069d2f2
"""Tests for the C version of the StopWordRemover."""
import
unittest
from
Products.ZCTextIndex
import
stopper
class
StopperTest
(
unittest
.
TestCase
):
def
test_constructor_empty
(
self
):
s
=
stopper
.
new
()
self
.
assertEqual
(
s
.
dict
,
{})
def
test_constructor_dict
(
self
):
d
=
{}
s
=
stopper
.
new
(
d
)
self
.
assert_
(
s
.
dict
is
d
)
def
test_constructor_error
(
self
):
self
.
assertRaises
(
TypeError
,
stopper
.
new
,
[])
self
.
assertRaises
(
TypeError
,
stopper
.
new
,
{},
'extra arg'
)
def
test_process_nostops
(
self
):
s
=
stopper
.
new
()
words
=
[
'a'
,
'b'
,
'c'
,
'splat!'
]
self
.
assertEqual
(
words
,
s
.
process
(
words
))
def
test_process_somestops
(
self
):
s
=
stopper
.
new
({
'b'
:
1
,
'splat!'
:
1
})
words
=
[
'a'
,
'b'
,
'c'
,
'splat!'
]
self
.
assertEqual
([
'a'
,
'c'
],
s
.
process
(
words
))
def
test_process_allstops
(
self
):
s
=
stopper
.
new
({
'a'
:
1
,
'b'
:
1
,
'c'
:
1
,
'splat!'
:
1
})
words
=
[
'a'
,
'b'
,
'c'
,
'splat!'
]
self
.
assertEqual
([],
s
.
process
(
words
))
def
test_suite
():
return
unittest
.
makeSuite
(
StopperTest
)
if
__name__
==
"__main__"
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
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