diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-10-28 10:23:57 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-10-28 10:23:57 (GMT) |
commit | 91ec2e8a313edd08b4f10775173bbff714d8050a (patch) | |
tree | 92184035cee266c344b3caf304cf7ae8b995acf7 /Lib/test/test_htmlparser.py | |
parent | 455036fd1fe0580cb1e45e86cec268e07e5baf70 (diff) | |
parent | f50ffa94abe67c6ef5e615198af15f72e7cd2a9b (diff) | |
download | cpython-91ec2e8a313edd08b4f10775173bbff714d8050a.zip cpython-91ec2e8a313edd08b4f10775173bbff714d8050a.tar.gz cpython-91ec2e8a313edd08b4f10775173bbff714d8050a.tar.bz2 |
#13273: merge with 3.2.
Diffstat (limited to 'Lib/test/test_htmlparser.py')
-rw-r--r-- | Lib/test/test_htmlparser.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index d45e453..9664485 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -373,6 +373,39 @@ class HTMLParserTolerantTestCase(TestCaseBase): [('action', 'bogus|&#()value')])], collector = self.collector) + def test_issue13273(self): + html = ('<div style="" ><b>The <a href="some_url">rain</a> ' + '<br /> in <span>Spain</span></b></div>') + expected = [ + ('starttag', 'div', [('style', '')]), + ('starttag', 'b', []), + ('data', 'The '), + ('starttag', 'a', [('href', 'some_url')]), + ('data', 'rain'), + ('endtag', 'a'), + ('data', ' '), + ('startendtag', 'br', []), + ('data', ' in '), + ('starttag', 'span', []), + ('data', 'Spain'), + ('endtag', 'span'), + ('endtag', 'b'), + ('endtag', 'div') + ] + self._run_check(html, expected, collector=self.collector) + + def test_issue13273_2(self): + html = '<div style="", foo = "bar" ><b>The <a href="some_url">rain</a>' + expected = [ + ('starttag', 'div', [('style', ''), ('foo', 'bar')]), + ('starttag', 'b', []), + ('data', 'The '), + ('starttag', 'a', [('href', 'some_url')]), + ('data', 'rain'), + ('endtag', 'a'), + ] + self._run_check(html, expected, collector=self.collector) + def test_unescape_function(self): p = html.parser.HTMLParser() self.assertEqual(p.unescape('&#bad;'),'&#bad;') |