cpython: 20be90a3a714 (original) (raw)
Mercurial > cpython
changeset 83587:20be90a3a714
#17802: merge with 3.3. [#17802]
Ezio Melotti ezio.melotti@gmail.com | |
---|---|
date | Wed, 01 May 2013 16:20:00 +0300 |
parents | 9ea84f006892(current diff)9cb90c1a1a46(diff) |
children | e6b962fa44bb |
files | Lib/html/parser.py Misc/NEWS |
diffstat | 3 files changed, 18 insertions(+), 0 deletions(-)[+] [-] Lib/html/parser.py 1 Lib/test/test_htmlparser.py 14 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/html/parser.py +++ b/Lib/html/parser.py @@ -251,6 +251,7 @@ class HTMLParser(_markupbase.ParserBase) if self.strict: self.error("EOF in middle of entity or char ref") else:
k = match.end()[](#l1.7) if k <= i:[](#l1.8) k = n[](#l1.9) i = self.updatepos(i, i + 1)[](#l1.10)
--- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -535,6 +535,20 @@ class HTMLParserTolerantTestCase(HTMLPar ] self._run_check(html, expected)
- def test_EOF_in_charref(self):
# see #17802[](#l2.8)
# This test checks that the UnboundLocalError reported in the issue[](#l2.9)
# is not raised, however I'm not sure the returned values are correct.[](#l2.10)
# Maybe HTMLParser should use self.unescape for these[](#l2.11)
data = [[](#l2.12)
('a&', [('data', 'a&')]),[](#l2.13)
('a&b', [('data', 'ab')]),[](#l2.14)
('a&b ', [('data', 'a'), ('entityref', 'b'), ('data', ' ')]),[](#l2.15)
('a&b;', [('data', 'a'), ('entityref', 'b')]),[](#l2.16)
][](#l2.17)
for html, expected in data:[](#l2.18)
self._run_check(html, expected)[](#l2.19)
+ def test_unescape_function(self): p = self.get_collector() self.assertEqual(p.unescape('&#bad;'),'&#bad;')