From c556b8a6b42843fac40c55459aa5c494e2798349 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sat, 6 May 2017 13:34:52 -0400 Subject: HTML parsers treat all HTML4 and HTML5 empty element tags (aka void element tags) correctly. [bug=1656909] --- bs4/testing.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bs4/testing.py') diff --git a/bs4/testing.py b/bs4/testing.py index 733cc29..9d89de7 100644 --- a/bs4/testing.py +++ b/bs4/testing.py @@ -69,6 +69,18 @@ class HTMLTreeBuilderSmokeTest(object): markup in these tests, there's not much room for interpretation. """ + def test_empty_element_tags(self): + """Verify that all HTML4 and HTML5 empty element (aka void element) tags + are handled correctly. + """ + for name in [ + 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr', + 'spacer', 'frame' + ]: + soup = self.soup("") + new_tag = soup.new_tag(name) + self.assertEqual(True, new_tag.is_empty_element) + def test_pickle_and_unpickle_identity(self): # Pickling a tree, then unpickling it, yields a tree identical # to the original. -- cgit v1.2.3