Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_nodes():
html = (
'<div><p id="p1"></p><p id="p2"></p><p id="p3"><a>link</a></p>'
'<p id="p4"></p><p id="p5">text</p><p id="p6"></p></div>'
)
htmlp = HTMLParser(html)
assert isinstance(htmlp.root, Node)
assert isinstance(htmlp.body, Node)
html_output = htmlp.html
assert len(html_output) >= len(html)
assert SequenceMatcher(None, html, html_output).ratio() > 0.8
def test_nodes():
html = (
'<div><p id="p1"></p><p id="p2"></p><p id="p3"><a>link</a></p>'
'<p id="p4"></p><p id="p5">text</p><p id="p6"></p></div>'
)
htmlp = HTMLParser(html)
assert isinstance(htmlp.root, Node)
assert isinstance(htmlp.body, Node)
html_output = htmlp.html
assert len(html_output) >= len(html)
assert SequenceMatcher(None, html, html_output).ratio() > 0.8