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
commitb5ffba33327acaf51a2274f9e0a5305b5fb8bdf9 (patch)
treee627743f2434291a3cb12139c4ae45b8088d8592 /bs4/tests/test_htmlparser.py
parentb2836d45288e0de1474ecc555f6e3aac51f3168c (diff)
downloadbeautifulsoup4-b5ffba33327acaf51a2274f9e0a5305b5fb8bdf9.tar.gz
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):