bs4.tests.test_htmlparser#

Tests to ensure that the html.parser tree builder generates good trees.

Module Contents#

Classes#

TestHTMLParserTreeBuilder

A basic test of a treebuilder's competence.

class bs4.tests.test_htmlparser.TestHTMLParserTreeBuilder#

Bases: bs4.tests.SoupTest, bs4.tests.HTMLTreeBuilderSmokeTest

A basic test of a treebuilder’s competence.

Any HTML treebuilder, present or future, should be able to pass these tests. With invalid markup, there’s room for interpretation, and different parsers can handle it differently. But with the markup in these tests, there’s not much room for interpretation.

default_builder#
test_rejected_input()#
test_namespaced_system_doctype()#
test_namespaced_public_doctype()#
test_builder_is_pickled()#

Unlike most tree builders, HTMLParserTreeBuilder and will be restored after pickling.

test_redundant_empty_element_closing_tags()#
test_empty_element()#
test_tracking_line_numbers()#
test_on_duplicate_attribute()#
test_html5_attributes()#