summaryrefslogtreecommitdiff
path: root/tests/test_unidecode.py
diff options
context:
space:
mode:
authorTomaz Solc <tomaz.solc@tablix.org>2018-12-30 15:31:04 +0100
committerTomaz Solc <tomaz.solc@tablix.org>2018-12-30 15:31:04 +0100
commit4b6a097f4ada716639aa1727aaaab64a829a873f (patch)
treede522a0e0395d06950cf3f460216ed5c2bf12a4c /tests/test_unidecode.py
parente3c730e5830f15c613f65f1764258165f4e5f52f (diff)
downloadunidecode-4b6a097f4ada716639aa1727aaaab64a829a873f.tar.gz
Check if all spaces are transliterated to spaces.
If x.isspace() is True, then unidecode(x).isspace() should be True as well (unless it is an empty string)
Diffstat (limited to 'tests/test_unidecode.py')
-rw-r--r--tests/test_unidecode.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_unidecode.py b/tests/test_unidecode.py
index 3ae23e9..f33b3ce 100644
--- a/tests/test_unidecode.py
+++ b/tests/test_unidecode.py
@@ -101,6 +101,15 @@ class BaseTestUnidecode():
wlog.stop()
self.assertEqual(0xe000-0xd800, len(wlog.log))
+ def test_space(self):
+ for n in range(0x80, 0x10000):
+ t = _chr(n)
+ if t.isspace():
+ s = self.unidecode(t)
+ self.assertTrue((s == '') or s.isspace(),
+ 'unidecode(%r) should return an empty string or ASCII space, '
+ 'since %r.isspace() is true. Instead it returns %r' % (t, t, s))
+
@unittest.skipIf(sys.maxunicode < 0x10000, "narrow build")
def test_surrogate_pairs(self):
# same character, written as a non-BMP character and a