File: unicodeliteralslatin1.pyx

package info (click to toggle)
cython 3.1.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,932 kB
  • sloc: python: 92,172; ansic: 19,275; cpp: 1,407; xml: 1,031; javascript: 511; makefile: 373; sh: 223; sed: 11
file content (77 lines) | stat: -rw-r--r-- 1,315 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- coding: latin-1 -*-

__doc__ = br"""
    >>> sa
    'abc'
    >>> ua
    'abc'
    >>> b
    '123'
    >>> c
    'S\xf8k ik'
    >>> d
    '\xfc\xd6\xe4'
    >>> e
    '\x03g\xf8\uf8d2S\xf8k ik'
    >>> f
    '\xf8'
    >>> add
    'S\xf8k ik\xfc\xd6\xe4abc'
    >>> null
    '\x00'
""".decode("ASCII") + b"""
    >>> len(sa)
    3
    >>> len(ua)
    3
    >>> len(b)
    3
    >>> len(c)
    6
    >>> len(d)
    3
    >>> len(e)
    10
    >>> len(f)
    1
    >>> len(add)
    12
    >>> len(null)
    1
""".decode("ASCII") + u"""
    >>> ua == 'abc'
    True
    >>> b == '123'
    True
    >>> c == 'Sk ik'
    True
    >>> d == ''
    True
    >>> e == '\x03\x67\xf8\uf8d2Sk ik'     # unescaped by Cython
    True
    >>> e == '\\x03\\x67\\xf8\\uf8d2Sk ik' # unescaped by Python
    True
    >>> f == '\xf8'  # unescaped by Cython
    True
    >>> f == '\\xf8' # unescaped by Python
    True
    >>> k == '' == '\\N{LATIN SMALL LETTER A WITH DIAERESIS}'
    True
    >>> add == 'Sk ik' + '' + 'abc'
    True
    >>> null == '\\x00' # unescaped by Python (required by doctest)
    True
"""

sa = 'abc'
ua = u'abc'

b = u'123'
c = u'Sk ik'
d = u''
e = u'\x03\x67\xf8\uf8d2Sk ik'
f = u'\xf8'
k = u'\N{LATIN SMALL LETTER A WITH DIAERESIS}'

add = u'Sk ik' + u'' + u'abc'
null = u'\x00'