summaryrefslogtreecommitdiff
path: root/test.py
blob: d713ee3616ea1e7d76099bb6a7ca75886702c71b (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
# -*- coding: utf-8 -*-

import unittest
from slugify import slugify

class TestSequenceFunctions(unittest.TestCase):

    def test_space_dash(self):
        txt = "This is a test ---"
        r = slugify(txt)
        self.assertEquals(r, "this-is-a-test")

    def test_special_chars(self):
        txt = 'C\'est déjà l\'été.'
        r = slugify(txt)
        self.assertEquals(r, "cest-deja-lete")

        txt = 'Nín hǎo. Wǒ shì zhōng guó rén'
        r = slugify(txt)
        self.assertEquals(r, "nin-hao-wo-shi-zhong-guo-ren")

        txt = '影師嗎'
        r = slugify(txt)
        self.assertEquals(r, "ying-shi-ma")

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