bs4.tests.test_dammit#

Module Contents#

Classes#

TestUnicodeDammit

Standalone tests of UnicodeDammit.

TestEncodingDetector

TestEntitySubstitution

Standalone tests of the EntitySubstitution class.

class bs4.tests.test_dammit.TestUnicodeDammit#

Bases: object

Standalone tests of UnicodeDammit.

test_unicode_input()#
test_smart_quotes_to(smart_quotes_to, expect_converted)#

Verify the functionality of the smart_quotes_to argument to the UnicodeDammit constructor.

test_detect_utf8()#
test_convert_hebrew()#
test_dont_see_smart_quotes_where_there_are_none()#
test_ignore_inappropriate_codecs()#
test_ignore_invalid_codecs()#
test_exclude_encodings()#
class bs4.tests.test_dammit.TestEncodingDetector#

Bases: object

test_encoding_detector_replaces_junk_in_encoding_name_with_replacement_character()#
test_detect_html5_style_meta_tag()#
test_last_ditch_entity_replacement()#
test_byte_order_mark_removed()#
test_known_definite_versus_user_encodings()#
test_deprecated_override_encodings()#
test_detwingle()#
test_detwingle_ignores_multibyte_characters()#
test_find_declared_encoding()#
class bs4.tests.test_dammit.TestEntitySubstitution#

Bases: object

Standalone tests of the EntitySubstitution class.

setup_method()#
test_substitute_html(original, substituted)#
test_html5_entity()#
test_html5_entity_with_variation_selector()#
test_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_false()#
test_xml_attribute_quoting_normally_uses_double_quotes()#
test_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quotes()#
test_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quotes()#
test_xml_quotes_arent_escaped_when_value_is_not_being_quoted()#
test_xml_quoting_handles_angle_brackets()#
test_xml_quoting_handles_ampersands()#
test_xml_quoting_including_ampersands_when_they_are_part_of_an_entity()#
test_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entity()#
test_quotes_not_html_substituted()#

There’s no need to do this except inside attribute values.