1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# -*- coding: utf-8 -*-
import unittest
from unidecode import unidecode
class TestUnidecode(unittest.TestCase):
def test_ascii(self):
for n in xrange(0,128):
t = chr(n)
self.failUnlessEqual(unidecode(t), t)
def test_specific(self):
TESTS = [
(u"Hello, World!",
"Hello, World!"),
(u"'\"\r\n",
"'\"\r\n"),
(u"ČŽŠčžš",
"CZSczs"),
(u"ア",
"a"),
(u"α",
"a"),
(u"а",
"a"),
]
for input, output in TESTS:
self.failUnlessEqual(unidecode(input), output)
|