Cython has moved to github.

cython-devel

view tests/run/unicodeliterals.pyx @ 406:4cb0e7014a92

more unicode tests
author Stefan Behnel <scoder@users.berlios.de>
date Wed Apr 09 20:15:20 2008 +0200 (4 years ago)
parents 8e59e7769514
children 44faaf8a1bf2
line source
1 # -*- coding: utf-8 -*-
3 __doc__ = r"""
4 >>> sa
5 'abc'
6 >>> ua
7 u'abc'
8 >>> b
9 u'123'
10 >>> c
11 u'S\xf8k ik'
12 >>> d
13 u'\xfc\xd6\xe4'
14 >>> e
15 u'\x03g\xf8\uf8d2S\xf8k ik'
16 >>> f
17 u'\xf8'
18 >>> add
19 u'S\xf8k ik\xfc\xd6\xe4abc'
20 >>> null
21 u'\x00'
22 """ + """
23 >>> len(sa)
24 3
25 >>> len(ua)
26 3
27 >>> len(b)
28 3
29 >>> len(c)
30 6
31 >>> len(d)
32 3
33 >>> len(e)
34 10
35 >>> len(f)
36 1
37 >>> len(add)
38 12
39 >>> len(null)
40 1
41 """ + u"""
42 >>> sa == 'abc'
43 True
44 >>> ua == u'abc'
45 True
46 >>> b == u'123'
47 True
48 >>> c == u'Søk ik'
49 True
50 >>> d == u'üÖä'
51 True
52 >>> e == u'\x03\x67\xf8\uf8d2Søk ik' # unescaped by Cython
53 True
54 >>> e == u'\\x03\\x67\\xf8\\uf8d2Søk ik' # unescaped by Python
55 True
56 >>> f == u'\xf8' # unescaped by Cython
57 True
58 >>> f == u'\\xf8' # unescaped by Python
59 True
60 >>> add == u'Søk ik' + u'üÖä' + 'abc'
61 True
62 >>> null == u'\\x00' # unescaped by Python (required by doctest)
63 True
64 """
66 sa = 'abc'
67 ua = u'abc'
69 b = u'123'
70 c = u'Søk ik'
71 d = u'üÖä'
72 e = u'\x03\x67\xf8\uf8d2Søk ik'
73 f = u'\xf8'
75 add = u'Søk ik' + u'üÖä' + 'abc'
76 null = u'\x00'