diff options
author | wurstsalat <mailtrash@posteo.de> | 2022-12-10 00:10:14 +0300 |
---|---|---|
committer | wurstsalat <mailtrash@posteo.de> | 2022-12-10 00:10:57 +0300 |
commit | 6b9cb54872e7fc0519e896bedea5a96386d4ee08 (patch) | |
tree | 5a53f6807f0ac62ede1de7a8f59999153e7f0153 /test | |
parent | 38ed76210f509541ba970e51bed28d1dc5892941 (diff) |
cq: Move remove_invalid_xml_chars method and add test
Diffstat (limited to 'test')
-rw-r--r-- | test/no_gui/test_text_helpers.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/no_gui/test_text_helpers.py b/test/no_gui/test_text_helpers.py index c71b8ee8e..bdff8f317 100644 --- a/test/no_gui/test_text_helpers.py +++ b/test/no_gui/test_text_helpers.py @@ -3,9 +3,23 @@ import unittest from gajim.common.text_helpers import escape_iri_path_segment from gajim.common.text_helpers import jid_to_iri from gajim.common.text_helpers import format_duration +from gajim.common.text_helpers import remove_invalid_xml_chars class Test(unittest.TestCase): + + def test_remove_invalid_xml_chars(self) -> None: + invalid_chars = [ + '\x0b', + '\udfff', + '\x08' + ] + for char in invalid_chars: + self.assertEqual(remove_invalid_xml_chars(char), '') + + self.assertEqual(remove_invalid_xml_chars(''), '') + self.assertEqual(remove_invalid_xml_chars('ä'), 'ä') + def test_escape_iri_path_segment(self): self.assertEqual(escape_iri_path_segment(''), '', '<empty string>') |