[Python-checkins] CVS: python/dist/src/Lib/test test_htmlparser.py,1.2,1.3
Fred L. Drake
fdrake@users.sourceforge.net
Fri, 03 Aug 2001 12:53:03 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv30974
Modified Files:
test_htmlparser.py
Log Message:
Fix stupid bug: when migrating these tests from the Zope repository, the
names of the test methods were not changed from the Zope-standard "check"
names to the Python-standard "test_" names, so the tests were not actually
being run.
Added test of hexadecimal character references as a regression check for
SF bug #445196.
Index: test_htmlparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmlparser.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_htmlparser.py 2001/07/16 18:50:29 1.2
--- test_htmlparser.py 2001/08/03 19:53:01 1.3
***************
*** 101,110 ****
class HTMLParserTestCase(TestCaseBase):
! def check_processing_instruction_only(self):
self._run_check("<?processing instruction>", [
("pi", "processing instruction"),
])
! def check_simple_html(self):
self._run_check("""
<!DOCTYPE html PUBLIC 'foo'>
--- 101,110 ----
class HTMLParserTestCase(TestCaseBase):
! def test_processing_instruction_only(self):
self._run_check("<?processing instruction>", [
("pi", "processing instruction"),
])
! def test_simple_html(self):
self._run_check("""
<!DOCTYPE html PUBLIC 'foo'>
***************
*** 115,118 ****
--- 115,119 ----
<Img sRc='Bar' isMAP>sample
text
+ “
<!--comment2a-- --comment2b-->
</Html>
***************
*** 129,132 ****
--- 130,135 ----
("starttag", "img", [("src", "Bar"), ("ismap", None)]),
("data", "sample\ntext\n"),
+ ("charref", "x201C"),
+ ("data", "\n"),
("comment", "comment2a-- --comment2b"),
("data", "\n"),
***************
*** 135,139 ****
])
! def check_bad_nesting(self):
self._run_check("<a><b></a></b>", [
("starttag", "a", []),
--- 138,145 ----
])
! def test_bad_nesting(self):
! # Strangely, this *is* supposed to test that overlapping
! # elements are allowed. HTMLParser is more geared toward
! # lexing the input that parsing the structure.
self._run_check("<a><b></a></b>", [
("starttag", "a", []),
***************
*** 143,147 ****
])
! def check_attr_syntax(self):
output = [
("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", None)])
--- 149,153 ----
])
! def test_attr_syntax(self):
output = [
("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", None)])
***************
*** 152,156 ****
self._run_check("""<a\tb\t=\t'v'\tc\t=\t"v"\td\t=\tv\te>""", output)
! def check_attr_values(self):
self._run_check("""<a b='xxx\n\txxx' c="yyy\t\nyyy" d='\txyz\n'>""",
[("starttag", "a", [("b", "xxx\n\txxx"),
--- 158,162 ----
self._run_check("""<a\tb\t=\t'v'\tc\t=\t"v"\td\t=\tv\te>""", output)
! def test_attr_values(self):
self._run_check("""<a b='xxx\n\txxx' c="yyy\t\nyyy" d='\txyz\n'>""",
[("starttag", "a", [("b", "xxx\n\txxx"),
***************
*** 162,180 ****
])
! def check_attr_entity_replacement(self):
self._run_check("""<a b='&><"''>""", [
("starttag", "a", [("b", "&><\"'")]),
])
! def check_attr_funky_names(self):
self._run_check("""<a a.b='v' c:d=v e-f=v>""", [
("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]),
])
! def check_starttag_end_boundary(self):
self._run_check("""<a b='<'>""", [("starttag", "a", [("b", "<")])])
self._run_check("""<a b='>'>""", [("starttag", "a", [("b", ">")])])
! def check_buffer_artefacts(self):
output = [("starttag", "a", [("b", "<")])]
self._run_check(["<a b='<'>"], output)
--- 168,186 ----
])
! def test_attr_entity_replacement(self):
self._run_check("""<a b='&><"''>""", [
("starttag", "a", [("b", "&><\"'")]),
])
! def test_attr_funky_names(self):
self._run_check("""<a a.b='v' c:d=v e-f=v>""", [
("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]),
])
! def test_starttag_end_boundary(self):
self._run_check("""<a b='<'>""", [("starttag", "a", [("b", "<")])])
self._run_check("""<a b='>'>""", [("starttag", "a", [("b", ">")])])
! def test_buffer_artefacts(self):
output = [("starttag", "a", [("b", "<")])]
self._run_check(["<a b='<'>"], output)
***************
*** 193,197 ****
self._run_check(["<a b='>'", ">"], output)
! def check_starttag_junk_chars(self):
self._parse_error("<")
self._parse_error("<>")
--- 199,203 ----
self._run_check(["<a b='>'", ">"], output)
! def test_starttag_junk_chars(self):
self._parse_error("<")
self._parse_error("<>")
***************
*** 213,220 ****
self._parse_error("<a foo=>")
! def check_declaration_junk_chars(self):
self._parse_error("<!DOCTYPE foo $ >")
! def check_startendtag(self):
self._run_check("<p/>", [
("startendtag", "p", []),
--- 219,226 ----
self._parse_error("<a foo=>")
! def test_declaration_junk_chars(self):
self._parse_error("<!DOCTYPE foo $ >")
! def test_startendtag(self):
self._run_check("<p/>", [
("startendtag", "p", []),
***************
*** 230,234 ****
])
! def check_get_starttag_text(self):
s = """<foo:bar \n one="1"\ttwo=2 >"""
self._run_check_extra(s, [
--- 236,240 ----
])
! def test_get_starttag_text(self):
s = """<foo:bar \n one="1"\ttwo=2 >"""
self._run_check_extra(s, [
***************
*** 236,240 ****
("starttag_text", s)])
! def check_cdata_content(self):
s = """<script> <!-- not a comment --> ¬-an-entity-ref; </script>"""
self._run_check(s, [
--- 242,246 ----
("starttag_text", s)])
! def test_cdata_content(self):
s = """<script> <!-- not a comment --> ¬-an-entity-ref; </script>"""
self._run_check(s, [