Esempio n. 1
0
    def test_unaccent(self):
        """Check unicode casting removing accents"""

        result = to_unicode('Tomáš Čechvala', unaccent=True)
        self.assertEqual(result, 'Tomas Cechvala')

        result = to_unicode('Santiago Dueñas', unaccent=True)
        self.assertEqual(result, 'Santiago Duenas')

        result = to_unicode(1234, unaccent=True)
        self.assertEqual(result, '1234')
Esempio n. 2
0
    def test_to_unicode(self):
        """Check unicode casting with several cases"""

        result = to_unicode('abcdefghijk')
        self.assertEqual(result, 'abcdefghijk')

        result = to_unicode(None)
        self.assertEqual(result, 'None')

        result = to_unicode(1234)
        self.assertEqual(result, '1234')

        result = to_unicode(1234.4321)
        self.assertEqual(result, '1234.4321')
Esempio n. 3
0
    def test_unaccent(self):
        """Check unicode casting removing accents"""

        result = to_unicode(u'Tomáš Čechvala', unaccent=True)
        self.assertEqual(result, u'Tomas Cechvala')

        result = to_unicode('Tomáš Čechvala', unaccent=True)
        self.assertEqual(result, u'Tomas Cechvala')

        result = to_unicode('Santiago Dueñas', unaccent=True)
        self.assertEqual(result, u'Santiago Duenas')

        result = to_unicode(1234, unaccent=True)
        self.assertEqual(result, u'1234')
Esempio n. 4
0
    def test_to_unicode(self):
        """Check unicode casting with several cases"""

        result = to_unicode(u'abcdefghijk')
        self.assertEqual(result, u'abcdefghijk')

        result = to_unicode('abcdefghijk')
        self.assertEqual(result, u'abcdefghijk')

        result = to_unicode(None)
        self.assertEqual(result, u'None')

        result = to_unicode(1234)
        self.assertEqual(result, '1234')

        result = to_unicode(1234.4321)
        self.assertEqual(result, '1234.4321')