Cython has moved to github.
cython-devel
view tests/run/or.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 | 35babe5df668 |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> a,b = 'a *','b *' # use non-interned strings
4 >>> or2_assign(2,3) == (2 or 3)
5 True
6 >>> or2_assign('a', 'b') == ('a' or 'b')
7 True
8 >>> or2_assign(a, b) == (a or b)
9 True
11 >>> or2(2,3) == (2 or 3)
12 True
13 >>> or2(0,2) == (0 or 2)
14 True
15 >>> or2('a', 'b') == ('a' or 'b')
16 True
17 >>> or2(a, b) == (a or b)
18 True
19 >>> or2('', 'b') == ('' or 'b')
20 True
21 >>> or2([], [1]) == ([] or [1])
22 True
23 >>> or2([], [a]) == ([] or [a])
24 True
26 >>> or3(0,1,2) == (0 or 1 or 2)
27 True
28 >>> or3([],(),[1]) == ([] or () or [1])
29 True
31 >>> or2_no_result(2,3)
32 >>> or2_no_result(0,2)
33 >>> or2_no_result('a','b')
34 >>> or2_no_result(a,b)
35 >>> a or b
36 'a *'
37 """
39 def or2_assign(a,b):
40 c = a or b
41 return c
43 def or2(a,b):
44 return a or b
46 def or3(a,b,c):
47 d = a or b or c
48 return d
50 def or2_no_result(a,b):
51 a or b
