From 84bb9d8dc463eaa3e38080e4ee6fe3d150b3cb1b Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 3 Aug 2001 19:53:01 +0000 Subject: 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. --- Lib/test/test_htmlparser.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index 0f3cf80..e0e212c 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("