From: Ezio Melotti Date: Mon, 13 Feb 2012 12:11:27 +0000 (+0200) Subject: Fix htmlparser tests to always use the right collector. X-Git-Tag: v3.2.3rc1~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=86f67123befc7f5fe76c97d7e08502846f04722d;p=thirdparty%2FPython%2Fcpython.git Fix htmlparser tests to always use the right collector. --- diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index 2e7277e573db..3d3f8593b556 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -93,7 +93,7 @@ class TestCaseBase(unittest.TestCase): def _parse_error(self, source): def parse(source=source): - parser = html.parser.HTMLParser() + parser = self.get_collector() 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', '", [('endtag', 'a'", [('data', "', + [('comment', 'spacer type="block" height="25"')]) + def test_with_unquoted_attributes(self): # see #12008 html = ("" @@ -476,7 +500,7 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase): self._run_check(html, expected) def test_unescape_function(self): - p = html.parser.HTMLParser() + p = self.get_collector() self.assertEqual(p.unescape('&#bad;'),'&#bad;') self.assertEqual(p.unescape('&'),'&') # see #12888