summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-010-transliterate.py
blob: 7f70700d6cb7a8af095ce89b9cdd40fa24018a39 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: utf-8 -*-

import unittest

class TestTransliteration(unittest.TestCase):
    def test_001_raw_fr_FR(self):
        """
            The special thing about this case is that the givenname starts with
            a special character.
        """
        from pykolab import utils
        givenname = r'Étienne-Nicolas'
        surname = r'Méhul'

        preferredlanguage = 'fr_FR'

        self.assertEqual('Etienne-Nicolas', utils.translate(givenname, preferredlanguage))
        self.assertEqual('Mehul', utils.translate(surname, preferredlanguage))

    def test_002_unicode_fr_FR(self):
        """
            The special thing about this case is that the givenname starts with
            a special character.
        """
        from pykolab import utils
        givenname = 'Étienne-Nicolas'
        surname = 'Méhul'

        preferredlanguage = 'fr_FR'

        self.assertEqual('Etienne-Nicolas', utils.translate(givenname, preferredlanguage))
        self.assertEqual('Mehul', utils.translate(surname, preferredlanguage))

    def test_003_raw_es_ES(self):
        """
            The special thing about this case is that the givenname starts with
            a special character.
        """
        from pykolab import utils
        givenname = r'Álvaro'
        surname = r'Fuentes'

        preferredlanguage = 'es_ES'

        self.assertEqual('Alvaro', utils.translate(givenname, preferredlanguage))
        self.assertEqual('Fuentes', utils.translate(surname, preferredlanguage))

    def test_004_unicode_es_ES(self):
        """
            The special thing about this case is that the givenname starts with
            a special character.
        """
        from pykolab import utils
        givenname = 'Álvaro'
        surname = 'Fuentes'

        preferredlanguage = 'es_ES'

        self.assertEqual('Alvaro', utils.translate(givenname, preferredlanguage))
        self.assertEqual('Fuentes', utils.translate(surname, preferredlanguage))


if __name__ == '__main__':
    unittest.main()