How to use the justext.utils.normalize_whitespace function in jusText

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_utils.py View on Github external
def test_normalize_newline_and_tab(self):
        string = "123 \n456\t\n"
        expected = "123\n456\n"
        assert expected == normalize_whitespace(string)
github miso-belica / jusText / tests / test_utils.py View on Github external
def test_normalize_no_change(self):
        string = "a b c d e f g h i j k l m n o p q r s ..."
        assert string == normalize_whitespace(string)
github miso-belica / jusText / tests / test_utils.py View on Github external
def test_normalize_dont_trim(self):
        string = "  a b c d e f g h i j k l m n o p q r s ...  "
        expected = " a b c d e f g h i j k l m n o p q r s ... "
        assert expected == normalize_whitespace(string)
github miso-belica / jusText / tests / test_utils.py View on Github external
def test_normalize_non_break_spaces(self):
        string = "\u00A0\t €\u202F \t"
        expected = " € "
        assert expected == normalize_whitespace(string)
github miso-belica / jusText / justext / paragraph.py View on Github external
def text(self):
        text = "".join(self.text_nodes)
        return normalize_whitespace(text.strip())
github miso-belica / jusText / justext / paragraph.py View on Github external
def append_text(self, text):
        text = normalize_whitespace(text)
        self.text_nodes.append(text)
        return text