How to use jusText - 10 common examples

To help you get started, we’ve selected a few jusText examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miso-belica / jusText / tests / test_html_encoding.py View on Github external
def test_meta_detection_6(self):
        html = ' ľščťžäňôě'
        decoded_html = decode_html(html.encode("iso-8859-2"))

        self.assert_strings_equal(html, decoded_html)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
def test_meta_detection_4(self):
        html = ' ľščťžäňôě'
        decoded_html = decode_html(html.encode("iso-8859-2"))

        self.assert_strings_equal(html, decoded_html)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
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)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
def test_fake_encoding_in_meta(self):
        html = ' ľščťžäňôě'

        with pytest.raises(JustextError):
            decode_html(html.encode("iso-8859-2"), errors='strict')
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
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)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
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)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
def test_meta_detection_9(self):
        html = ' ľščťžäňôě'
        decoded_html = decode_html(html.encode("iso-8859-2"))

        self.assert_strings_equal(html, decoded_html)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
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)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
def test_meta_detection_2(self):
        html = ' ľščťžäňôě'
        decoded_html = decode_html(html.encode("iso-8859-2"))

        self.assert_strings_equal(html, decoded_html)
github miso-belica / jusText / tests / test_html_encoding.py View on Github external
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)