diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2015-09-06 18:44:45 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2015-09-06 18:44:45 (GMT) |
commit | 20a2c6482e28a2ca8d257ba646f2b8ead4837387 (patch) | |
tree | 92fc8ee593df66a6df5839130f1ab5be161aec46 /Lib/test/test_htmlparser.py | |
parent | 2ba39800e53140a3df6aed92ccbd1f99b9f83290 (diff) | |
parent | 6f2bb98966853edcf1855b9dd310529d071241a2 (diff) | |
download | cpython-20a2c6482e28a2ca8d257ba646f2b8ead4837387.zip cpython-20a2c6482e28a2ca8d257ba646f2b8ead4837387.tar.gz cpython-20a2c6482e28a2ca8d257ba646f2b8ead4837387.tar.bz2 |
#23144: merge with 3.4.
Diffstat (limited to 'Lib/test/test_htmlparser.py')
-rw-r--r-- | Lib/test/test_htmlparser.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index de8f3e8..11420b2c 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -72,9 +72,6 @@ class EventCollectorExtra(EventCollector): class EventCollectorCharrefs(EventCollector): - def get_events(self): - return self.events - def handle_charref(self, data): self.fail('This should never be called with convert_charrefs=True') @@ -633,6 +630,18 @@ text ] self._run_check(html, expected) + def test_convert_charrefs_dropped_text(self): + # #23144: make sure that all the events are triggered when + # convert_charrefs is True, even if we don't call .close() + parser = EventCollector(convert_charrefs=True) + # before the fix, bar & baz was missing + parser.feed("foo <a>link</a> bar & baz") + self.assertEqual( + parser.get_events(), + [('data', 'foo '), ('starttag', 'a', []), ('data', 'link'), + ('endtag', 'a'), ('data', ' bar & baz')] + ) + class AttributesTestCase(TestCaseBase): |