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
0ebb7437
Commit
0ebb7437
authored
Jun 10, 2009
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for HTMLSplitter.
parent
436c5a15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
src/Products/ZCTextIndex/tests/testHTMLSplitter.py
src/Products/ZCTextIndex/tests/testHTMLSplitter.py
+77
-0
No files found.
src/Products/ZCTextIndex/tests/testHTMLSplitter.py
0 → 100644
View file @
0ebb7437
##############################################################################
#
# Copyright (c) 2009 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test zope.index.text.htmlsplitter
"""
import
unittest
class
HTMLWordSplitterTests
(
unittest
.
TestCase
):
# Subclasses must define '_getBTreesFamily'
def
_getTargetClass
(
self
):
from
Products.ZCTextIndex.HTMLSplitter
import
HTMLWordSplitter
return
HTMLWordSplitter
def
_makeOne
(
self
):
return
self
.
_getTargetClass
()()
def
test_class_conforms_to_ISplitter
(
self
):
from
zope.interface.verify
import
verifyClass
from
Products.ZCTextIndex.interfaces
import
ISplitter
verifyClass
(
ISplitter
,
self
.
_getTargetClass
())
def
test_instance_conforms_to_ISplitter
(
self
):
from
zope.interface.verify
import
verifyObject
from
Products.ZCTextIndex.interfaces
import
ISplitter
verifyObject
(
ISplitter
,
self
.
_makeOne
())
def
test_process_empty_string
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
process
([
''
]),
[])
def
test_process_no_markup
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
process
([
'abc def'
]),
[
'abc'
,
'def'
])
def
test_process_w_markup
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
process
([
'<h1>abc</h1> <p>def</p>'
]),
[
'abc'
,
'def'
])
def
test_process_no_markup_w_glob
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
process
([
'abc?def hij*klm nop* qrs?'
]),
[
'abc'
,
'def'
,
'hij'
,
'klm'
,
'nop'
,
'qrs'
])
def
test_processGlob_empty_string
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
processGlob
([
''
]),
[])
def
test_processGlob_no_markup_no_glob
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
processGlob
([
'abc def'
]),
[
'abc'
,
'def'
])
def
test_processGlob_w_markup_no_glob
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
processGlob
([
'<h1>abc</h1> '
'<p>def</p>'
]),
[
'abc'
,
'def'
])
def
test_processGlob_no_markup_w_glob
(
self
):
splitter
=
self
.
_makeOne
()
self
.
assertEqual
(
splitter
.
processGlob
([
'abc?def hij*klm nop* qrs?'
]),
[
'abc?def'
,
'hij*klm'
,
'nop*'
,
'qrs?'
])
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
HTMLWordSplitterTests
),
))
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