Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
86f67123
Commit
86f67123
authored
Feb 13, 2012
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix htmlparser tests to always use the right collector.
parent
5211ffe4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
Lib/test/test_htmlparser.py
Lib/test/test_htmlparser.py
+26
-2
No files found.
Lib/test/test_htmlparser.py
View file @
86f67123
...
...
@@ -93,7 +93,7 @@ class TestCaseBase(unittest.TestCase):
def
_parse_error
(
self
,
source
):
def
parse
(
source
=
source
):
parser
=
html
.
parser
.
HTMLParse
r
()
parser
=
self
.
get_collecto
r
()
parser
.
feed
(
source
)
parser
.
close
()
self
.
assertRaises
(
html
.
parser
.
HTMLParseError
,
parse
)
...
...
@@ -368,6 +368,30 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
(
'comment'
,
'/img'
),
(
'endtag'
,
'html<'
)])
def
test_starttag_junk_chars
(
self
):
self
.
_run_check
(
"</>"
,
[])
self
.
_run_check
(
"</$>"
,
[(
'comment'
,
'$'
)])
self
.
_run_check
(
"</"
,
[(
'data'
,
'</'
)])
self
.
_run_check
(
"</a"
,
[(
'data'
,
'</a'
)])
# XXX this might be wrong
self
.
_run_check
(
"<a<a>"
,
[(
'data'
,
'<a'
),
(
'starttag'
,
'a'
,
[])])
self
.
_run_check
(
"</a<a>"
,
[(
'endtag'
,
'a<a'
)])
self
.
_run_check
(
"<!"
,
[(
'data'
,
'<!'
)])
self
.
_run_check
(
"<a"
,
[(
'data'
,
'<a'
)])
self
.
_run_check
(
"<a foo='bar'"
,
[(
'data'
,
"<a foo='bar'"
)])
self
.
_run_check
(
"<a foo='bar"
,
[(
'data'
,
"<a foo='bar"
)])
self
.
_run_check
(
"<a foo='>'"
,
[(
'data'
,
"<a foo='>'"
)])
self
.
_run_check
(
"<a foo='>"
,
[(
'data'
,
"<a foo='>"
)])
def
test_declaration_junk_chars
(
self
):
# XXX this is wrong
self
.
_run_check
(
"<!DOCTYPE foo $ >"
,
[(
'comment'
,
'DOCTYPE foo $ '
)])
def
test_illegal_declarations
(
self
):
# XXX this might be wrong
self
.
_run_check
(
'<!spacer type="block" height="25">'
,
[(
'comment'
,
'spacer type="block" height="25"'
)])
def
test_with_unquoted_attributes
(
self
):
# see #12008
html
=
(
"<html><body bgcolor=d0ca90 text='181008'>"
...
...
@@ -476,7 +500,7 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
self
.
_run_check
(
html
,
expected
)
def
test_unescape_function
(
self
):
p
=
html
.
parser
.
HTMLParse
r
()
p
=
self
.
get_collecto
r
()
self
.
assertEqual
(
p
.
unescape
(
'&#bad;'
),
'&#bad;'
)
self
.
assertEqual
(
p
.
unescape
(
'&'
),
'&'
)
# see #12888
...
...
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