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_meta_detection_6(self):
html = ' ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"))
self.assert_strings_equal(html, decoded_html)
def test_meta_detection_4(self):
html = ' ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"))
self.assert_strings_equal(html, decoded_html)
def test_meta_detection_charset_outside_3(self):
html = ' charset="iso-fake-29" ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"))
self.assert_strings_equal(html, decoded_html)
def test_fake_encoding_in_meta(self):
html = ' ľščťžäňôě'
with pytest.raises(JustextError):
decode_html(html.encode("iso-8859-2"), errors='strict')
def test_meta_detection_charset_outside_2(self):
html = ' charset="iso-fake-29" ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"))
self.assert_strings_equal(html, decoded_html)
def test_given_wrong_encoding(self):
html = 'ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"), encoding="ASCII")
self.assert_strings_equal("\ufffd" * len(html), decoded_html)
def test_meta_detection_9(self):
html = ' ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"))
self.assert_strings_equal(html, decoded_html)
def test_given_encoding(self):
html = 'ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"), encoding="iso-8859-2")
self.assert_strings_equal(html, decoded_html)
def test_meta_detection_2(self):
html = ' ľščťžäňôě'
decoded_html = decode_html(html.encode("iso-8859-2"))
self.assert_strings_equal(html, decoded_html)
def test_unknown_encoding_with_default_error_handler(self):
html = 'ľščťžäňôě'
decoded = decode_html(html.encode("iso-8859-2"), default_encoding="iso-8859-2")
self.assertEqual(decoded, html)