-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
When parsing and serializing HTML content, the output does not match the expected structure. Specifically, the serialized HTML lacks proper indentation and includes an empty <title> tag, while the expected output includes indentation and an empty <title> tag. This discrepancy indicates an issue with the serialization logic or the handling of default elements like , , and .
def test_parse_and_serialize_html(self):
self.html_content = '<!DOCTYPE html><div>Hello World</div>'
self.expected_serialized_html = '''<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div>Hello World</div>
</body>
</html>'''
# Parse the provided HTML content into a document object using the parser.
output = domonic.parseString(self.html_content)
# Assertions to ensure the functionality of parsing and serializing HTML
self.assertEqual(str(output), self.expected_serialized_html.strip(),
"The serialized HTML string should match the expected HTML structure, including the addition of default elements like <html>, <head>, and <body>.")Expected Behavior:
The serialized HTML should match the following structure, including proper indentation and an empty <title> tag:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div>Hello World</div>
</body>
</html>Actual Behavior:
The serialized HTML does not include proper indentation and does not add an empty <title> tag. The actual output is:
<html><head></head><body><div>Hello World</div></body></html>Metadata
Metadata
Assignees
Labels
No labels