test fix after str changes
[cython.git] / tests / run / literals.pyx
1 __doc__ = u"""
2     >>> foo()
3     >>> test_float(1./3)
4     True
5     >>> test_complex(1j/3)
6     True
7 """
8
9 def foo():
10     a = 42
11     a1 = 0123
12     a2 = 0xabc
13     a3 = 0xDEF
14     a4 = 1234567890L
15     b = 42.88e17
16     b0a = 1.
17     b0b = .1
18     b0c = 1.1
19     b0d = 1.e1
20     b0e = .1e1
21     b0f = 1.1e1
22     b0g = 1.1e-1
23     b0h = 1e1
24     b1 = 3j
25     b2 = 3.1415J
26     b3 = c'X'
27     c = "spanish inquisition"
28     d = "this" "parrot" "is" "resting"
29     e = 'single quoted string'
30     f = '"this is quoted"'
31     g = '''Triple single quoted string.'''
32     h = """Triple double quoted string."""
33     g1 = '''Two line triple
34 single quoted string.'''
35     h1 = """Two line triple
36 double quoted string."""
37     i = 'This string\
38  has an ignored newline.'
39     j = 'One-char escapes: \'\"\\\a\b\f\n\r\t\v'
40     k = b'Oct and hex escapes: \1 \12 \123 \x45 \xaf \xAF'
41     l = r'''This is\
42 a \three \line
43 raw string with some backslashes.'''
44     m = 'Three backslashed ordinaries: \c\g\+'
45     n = '''Triple single quoted string 
46 with ' and " quotes'''
47     o = """Triple double quoted string 
48 with ' and " quotes"""
49     p = "name_like_string"
50     q = "NameLikeString2"
51     r = "99_percent_un_namelike"
52     s = "Not an \escape"
53     t = b'this' b'parrot' b'is' b'resting'
54     u = u'this' u'parrot' u'is' u'resting'
55
56
57 def test_float(x):
58     return x == 1./3
59
60 def test_complex(x):
61     return x == 0.3333333333333333j