from ..htmlparser import parse_html_string, print_html_string def test_parser_handles_simple_html(): root_node = parse_html_string("
Hello World!
") assert print_html_string(root_node) == "Hello World!
" def test_parser_handles_html_with_brs(): root_node = parse_html_string("Hello
World!
Hello
World!
Hello
World!
") assert print_html_string(root_node) == "Hello
World!
" def test_parser_escapes_html_in_text_nodes(): root_node = parse_html_string("Hello <br> World!") assert print_html_string(root_node) == "Hello <br> World!" def test_parser_escapes_quotes_in_text_nodes(): root_node = parse_html_string('Hello "World"!') assert print_html_string(root_node) == "Hello "World"!" def test_parser_handles_attributes(): root_node = parse_html_string('Hello World!') assert print_html_string(root_node) == 'Hello World!' def test_parser_escapes_html_in_attributes_names(): root_node = parse_html_string('r="