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_preprocess_simple_bytes_string(self):
html_string = (
b'<title>Title</title>'
b'<h1>Header</h1>'
b'<p>pre<span>text</span>post<em>emph</em>popost</p>'
b'<p>footer <em>like</em> a boss</p>'
b' \n'
b''
)
dom = preprocessor(html_to_dom(html_string))
returned = html.tostring(dom).decode("utf8")
expected = (
''
'<h1>Header</h1>'
'<p>pre<span>text</span>post<em>emph</em>popost</p>'
'<p>footer <em>like</em> a boss</p>'
' \n'
''
)
assert expected == returned
def test_preprocess_simple_bytes_xhtml_string_with_declaration(self):
html_string = (
b''
b''
b''
b''
b'<title>Hello World</title>'
b''
b''
b''
b''
b''
b''
)
dom = preprocessor(html_to_dom(html_string))
returned = html.tostring(dom).decode("utf8")
expected = (
''
''
''
''
)
assert expected == returned
def test_preprocess_simple_unicode_string(self):
html_string = (
'<title>Title</title>'
'<h1>Header</h1>'
'<p>pre<span>text</span>post<em>emph</em>popost</p>'
'<p>footer <em>like</em> a boss</p>'
''
)
dom = preprocessor(html_to_dom(html_string))
returned = html.tostring(dom).decode("utf8")
expected = (
''
'<h1>Header</h1>'
'<p>pre<span>text</span>post<em>emph</em>popost</p>'
'<p>footer <em>like</em> a boss</p>'
''
)
assert expected == returned
def test_preprocess_simple_unicode_xhtml_string_with_declaration(self):
html_string = (
''
''
''
''
'<title>Hello World</title>'
''
''
''
''
''
''
)
dom = preprocessor(html_to_dom(html_string))
returned = html.tostring(dom).decode("utf8")
expected = (
''
''
''
''
)
assert expected == returned