diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index 0f3cf801faa..e0e212c27a5 100755 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -100,12 +100,12 @@ class TestCaseBase(unittest.TestCase): class HTMLParserTestCase(TestCaseBase): - def check_processing_instruction_only(self): + def test_processing_instruction_only(self): self._run_check("", [ ("pi", "processing instruction"), ]) - def check_simple_html(self): + def test_simple_html(self): self._run_check(""" &entity; @@ -114,6 +114,7 @@ class HTMLParserTestCase(TestCaseBase): comment1b--> sample text +“ """, [ @@ -128,13 +129,18 @@ text ("data", "\n"), ("starttag", "img", [("src", "Bar"), ("ismap", None)]), ("data", "sample\ntext\n"), + ("charref", "x201C"), + ("data", "\n"), ("comment", "comment2a-- --comment2b"), ("data", "\n"), ("endtag", "html"), ("data", "\n"), ]) - def check_bad_nesting(self): + 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("", [ ("starttag", "a", []), ("starttag", "b", []), @@ -142,7 +148,7 @@ text ("endtag", "b"), ]) - def check_attr_syntax(self): + def test_attr_syntax(self): output = [ ("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", None)]) ] @@ -151,7 +157,7 @@ text self._run_check("""""", output) self._run_check("""""", output) - def check_attr_values(self): + def test_attr_values(self): self._run_check("""""", [("starttag", "a", [("b", "xxx\n\txxx"), ("c", "yyy\t\nyyy"), @@ -161,21 +167,21 @@ text ("starttag", "a", [("b", ""), ("c", "")]), ]) - def check_attr_entity_replacement(self): + def test_attr_entity_replacement(self): self._run_check("""""", [ ("starttag", "a", [("b", "&><\"'")]), ]) - def check_attr_funky_names(self): + def test_attr_funky_names(self): self._run_check("""""", [ ("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]), ]) - def check_starttag_end_boundary(self): + def test_starttag_end_boundary(self): self._run_check("""""", [("starttag", "a", [("b", "<")])]) self._run_check("""""", [("starttag", "a", [("b", ">")])]) - def check_buffer_artefacts(self): + def test_buffer_artefacts(self): output = [("starttag", "a", [("b", "<")])] self._run_check([""], output) self._run_check([""], output) @@ -192,7 +198,7 @@ text self._run_check([""], output) self._run_check([""], output) - def check_starttag_junk_chars(self): + def test_starttag_junk_chars(self): self._parse_error("<") self._parse_error("<>") self._parse_error("") @@ -212,10 +218,10 @@ text self._parse_error("