Cython has moved to github.

cython-devel

view tests/run/unicodeliterals.pyx @ 1622:4f0327bdebc9

test for temp allocation bug in call
author Robert Bradshaw <robertwb@math.washington.edu>
date Sat Jan 17 01:25:34 2009 -0800 (3 years ago)
parents 95312b19ee49
children 24bd77ad030e
line source
1 # -*- coding: utf-8 -*-
3 __doc__ = r"""
4 >>> sa
5 b'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 """.decode(u"ASCII") + """
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 """.decode(u"ASCII") + u"""
42 >>> ua == u'abc'
43 True
44 >>> b == u'123'
45 True
46 >>> c == u'Søk ik'
47 True
48 >>> d == u'üÖä'
49 True
50 >>> e == u'\x03\x67\xf8\uf8d2Søk ik' # unescaped by Cython
51 True
52 >>> e == u'\\x03\\x67\\xf8\\uf8d2Søk ik' # unescaped by Python
53 True
54 >>> f == u'\xf8' # unescaped by Cython
55 True
56 >>> f == u'\\xf8' # unescaped by Python
57 True
58 >>> add == u'Søk ik' + u'üÖä' + 'abc'
59 True
60 >>> null == u'\\x00' # unescaped by Python (required by doctest)
61 True
62 """
64 import sys
65 if sys.version_info[0] >= 3:
66 __doc__ = __doc__.replace(u" u'", u" '")
67 else:
68 __doc__ = __doc__.replace(u" b'", u" '")
70 sa = 'abc'
71 ua = u'abc'
73 b = u'123'
74 c = u'Søk ik'
75 d = u'üÖä'
76 e = u'\x03\x67\xf8\uf8d2Søk ik'
77 f = u'\xf8'
79 add = u'Søk ik' + u'üÖä' + u'abc'
80 null = u'\x00'