Cython has moved to github.
cython-devel
view tests/run/list.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 | 6309e21af543 |
| children | 1c2ee9725be9 |
line source
1 __doc__ = u"""
2 >>> f(1, 2, 3, 4, 5)
3 []
4 >>> g(1, 2, 3, 4, 5)
5 [2]
6 >>> h(1, 2, 3, 4, 5)
7 [2, 3]
8 >>> j(1, 2, 3, 4, 5)
9 [2, 3, 4]
10 >>> k(1, 2, 3, 4, 5)
11 [17, 42, 88]
12 >>> test_list_pop()
13 (2, [1])
14 >>> test_list_pop0()
15 (1, [2])
16 >>> test_list_pop_all()
17 True
18 """
20 def f(obj1, obj2, obj3, obj4, obj5):
21 obj1 = []
22 return obj1
24 def g(obj1, obj2, obj3, obj4, obj5):
25 obj1 = [obj2]
26 return obj1
28 def h(obj1, obj2, obj3, obj4, obj5):
29 obj1 = [obj2, obj3]
30 return obj1
32 def j(obj1, obj2, obj3, obj4, obj5):
33 obj1 = [obj2, obj3, obj4]
34 return obj1
36 def k(obj1, obj2, obj3, obj4, obj5):
37 obj1 = [17, 42, 88]
38 return obj1
40 def test_list_pop():
41 cdef list s1
42 l1 = [1,2]
43 two = l1.pop()
44 return two, l1
46 def test_list_pop0():
47 cdef list s1
48 l1 = [1,2]
49 one = l1.pop(0)
50 return one, l1
52 def test_list_pop_all():
53 cdef list s1
54 l1 = [1,2]
55 try:
56 l1.pop()
57 l1.pop(-1)
58 l1.pop(0)
59 except IndexError:
60 return True
61 return False
