summaryrefslogtreecommitdiff
path: root/bs4/tests/test_htmlparser.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2018-07-15 08:27:40 -0400
committerLeonard Richardson <leonardr@segfault.org>2018-07-15 08:27:40 -0400
commit15038b22ea020ea79928af2831c4b1dff869bcd4 (patch)
tree9b1104a2a07a14aaa7e522b3f3cf88ace387206f /bs4/tests/test_htmlparser.py
parenta0457769bbdc682569dd41a48ae5acb1f21481cb (diff)
Stop data loss when encountering an empty numeric entity, and
possibly in other cases. Thanks to tos.kamiya for the fix. [bug=1698503]
Diffstat (limited to 'bs4/tests/test_htmlparser.py')
-rw-r--r--bs4/tests/test_htmlparser.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/tests/test_htmlparser.py b/bs4/tests/test_htmlparser.py
index c13d59f..0381c7d 100644
--- a/bs4/tests/test_htmlparser.py
+++ b/bs4/tests/test_htmlparser.py
@@ -34,6 +34,11 @@ class HTMLParserTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest):
self.assertSoupEquals('<br></br><br></br><br></br>', "<br/><br/><br/>")
self.assertSoupEquals('</br></br></br>', "")
+ def test_empty_element(self):
+ # This verifies that any buffered data present when the parser
+ # finishes working is handled.
+ self.assertSoupEquals("foo &# bar", "foo &amp;# bar")
+
class TestHTMLParserSubclass(SoupTest):
def test_error(self):