bs4.tests.test_css
#
Module Contents#
Classes#
Test basic CSS selector functionality. |
- class bs4.tests.test_css.TestCSSSelectors#
Bases:
bs4.tests.SoupTest
Test basic CSS selector functionality.
This functionality is implemented in soupsieve, which has a much more comprehensive test suite, so this is basically an extra check that soupsieve works as expected.
- HTML = Multiline-String#
Show Value
""" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>The title</title> <link rel="stylesheet" href="blah.css" type="text/css" id="l1"> </head> <body> <custom-dashed-tag class="dashed" id="dash1">Hello there.</custom-dashed-tag> <div id="main" class="fancy"> <div id="inner"> <h1 id="header1">An H1</h1> <p>Some text</p> <p class="onep" id="p1">Some more text</p> <h2 id="header2">An H2</h2> <p class="class1 class2 class3" id="pmulti">Another</p> <a href="http://bob.example.org/" rel="friend met" id="bob">Bob</a> <h2 id="header3">Another H2</h2> <a id="me" href="http://simonwillison.net/" rel="me">me</a> <span class="s1"> <a href="#" id="s1a1">span1a1</a> <a href="#" id="s1a2">span1a2 <span id="s1a2s1">test</span></a> <span class="span2"> <a href="#" id="s2a1">span2a1</a> </span> <span class="span3"></span> <custom-dashed-tag class="dashed" id="dash2"/> <div data-tag="dashedvalue" id="data1"/> </span> </div> <x id="xid"> <z id="zida"/> <z id="zidab"/> <z id="zidac"/> </x> <y id="yid"> <z id="zidb"/> </y> <p lang="en" id="lang-en">English</p> <p lang="en-gb" id="lang-en-gb">English UK</p> <p lang="en-us" id="lang-en-us">English US</p> <p lang="fr" id="lang-fr">French</p> </div> <div id="footer"> </div> """
- assertSelect#
- setup_method()#
- assert_selects(selector, expected_ids, **kwargs)#
Make sure that the given tags have the correct text.
This is used in tests that define a bunch of tags, each containing a single string, and then select certain strings by some mechanism.
- assert_select_multiple(*tests)#
- test_precompiled()#
- test_one_tag_one()#
- test_one_tag_many()#
- test_select_one_returns_none_if_no_match()#
- test_tag_in_tag_one()#
- test_tag_in_tag_many()#
- test_limit()#
- test_tag_no_match()#
- test_invalid_tag()#
- test_select_dashed_tag_ids()#
- test_select_dashed_by_id()#
- test_dashed_tag_text()#
- test_select_dashed_matches_find_all()#
- test_header_tags()#
- test_class_one()#
- test_class_mismatched_tag()#
- test_one_id()#
- test_bad_id()#
- test_items_in_id()#
- test_a_bunch_of_emptys()#
- test_multi_class_support()#
- test_multi_class_selection()#
- test_child_selector()#
- test_child_selector_id()#
- test_attribute_equals()#
- test_attribute_tilde()#
- test_attribute_startswith()#
- test_attribute_endswith()#
- test_attribute_contains()#
- test_attribute_exact_or_hypen()#
- test_attribute_exists()#
- test_quoted_space_in_selector_name()#
- test_unsupported_pseudoclass()#
- test_nth_of_type()#
- test_nth_of_type_direct_descendant()#
- test_id_child_selector_nth_of_type()#
- test_select_on_element()#
- test_overspecified_child_id()#
- test_adjacent_sibling_selector()#
- test_general_sibling_selector()#
- test_dangling_combinator()#
- test_sibling_combinator_wont_select_same_tag_twice()#
- test_multiple_select()#
- test_multiple_select_with_no_space()#
- test_multiple_select_with_more_space()#
- test_multiple_select_duplicated()#
- test_multiple_select_sibling()#
- test_multiple_select_tag_and_direct_descendant()#
- test_multiple_select_direct_descendant_and_tags()#
- test_multiple_select_indirect_descendant()#
- test_invalid_multiple_select()#
- test_multiple_select_attrs()#
- test_multiple_select_ids()#
- test_multiple_select_nested()#
- test_select_duplicate_elements()#
- test_closest()#
- test_match()#
- test_iselect()#
- test_filter()#
- test_escape()#