4
def f(obj1, obj2, obj3, obj4, obj5):
12
def g(obj1, obj2, obj3, obj4, obj5):
20
def h(obj1, obj2, obj3, obj4, obj5):
28
def j(obj1, obj2, obj3, obj4, obj5):
33
obj1 = [obj2, obj3, obj4]
36
def k(obj1, obj2, obj3, obj4, obj5):
44
@cython.test_fail_if_path_exists("//SimpleCallNode")
45
def test_list_call(ob):
66
def test_list_sort_reversed():
69
l1.sort(reversed=True)
72
def test_list_reverse():
74
>>> test_list_reverse()
83
@cython.test_assert_path_exists(
84
'//SimpleCallNode//AttributeNode[@entry.cname = "__Pyx_PyList_Append"]',
86
def test_list_append():
88
>>> test_list_append()
97
@cython.test_assert_path_exists(
98
'//SimpleCallNode//NameNode[@entry.cname = "__Pyx_PyList_Append"]',
100
def test_list_append_unbound():
102
>>> test_list_append_unbound()
111
@cython.test_assert_path_exists(
112
'//SimpleCallNode//NameNode[@entry.cname = "__Pyx_PyList_Append"]',
114
def test_list_append_unbound_assigned():
116
>>> test_list_append_unbound_assigned()
126
def test_list_append_insert():
128
>>> test_list_append_insert()
156
def test_list_pop_all():
158
>>> test_list_pop_all()
176
@cython.test_assert_path_exists(
177
'//PythonCapiCallNode//PythonCapiFunctionNode[@cname = "__Pyx_ListComp_Append"]',
178
'//PythonCapiCallNode//PythonCapiFunctionNode[@cname = "__Pyx_PyList_Append"]',
180
def test_list_extend(seq=None, x=4):
182
>>> test_list_extend()
183
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
184
>>> test_list_extend([])
185
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
186
>>> test_list_extend([1])
187
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1]
188
>>> test_list_extend([1, 2])
189
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2]
191
cdef list l = [1,2,3]
194
l.extend(set()) # not currently optimised (not worth the trouble)
198
l.extend([7,8,9,10,11,12,13,14,15,16])
204
@cython.test_assert_path_exists(
205
'//PythonCapiCallNode//PythonCapiFunctionNode[@cname = "__Pyx_ListComp_Append"]',
206
'//PythonCapiCallNode//PythonCapiFunctionNode[@cname = "__Pyx_PyList_Append"]',
208
def test_list_extend_unbound(seq=None, x=4):
210
>>> test_list_extend_unbound()
211
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
212
>>> test_list_extend_unbound([])
213
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
214
>>> test_list_extend_unbound([1])
215
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1]
216
>>> test_list_extend_unbound([1, 2])
217
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2]
219
cdef list l = [1,2,3]
227
assert False, "TypeError not raised!"
228
list.extend(l, set()) # not currently optimised (not worth the trouble)
231
list.extend(l, [4,x+1,6])
232
list.extend(l, [7,8,9,10,11,12,13,14,15,16])
237
@cython.test_assert_path_exists(
238
'//PythonCapiCallNode//PythonCapiFunctionNode[@cname = "__Pyx_ListComp_Append"]',
239
'//PythonCapiCallNode//PythonCapiFunctionNode[@cname = "__Pyx_PyList_Append"]',
241
def test_list_extend_sideeffect(seq=None, exc=False):
243
>>> test_list_extend_sideeffect()
244
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [4, 6, 7, 8])
245
>>> test_list_extend_sideeffect([])
246
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [4, 6, 7, 8])
247
>>> test_list_extend_sideeffect([], exc=True)
248
([1, 2, 3, 10, 11, 12, 13, 14, 15, 16], [4, 7, 8])
249
>>> test_list_extend_sideeffect([1])
250
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1], [4, 6, 7, 8])
251
>>> test_list_extend_sideeffect([1], exc=True)
252
([1, 2, 3, 10, 11, 12, 13, 14, 15, 16, 1], [4, 7, 8])
253
>>> test_list_extend_sideeffect([1, 2])
254
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2], [4, 6, 7, 8])
257
def sideeffect(value):
262
raise TypeError("HUHU")
265
cdef list l = [1,2,3]
268
l.extend(set()) # not currently optimised (not worth the trouble)
272
# Must first build all items, then append them in order.
273
# If building one value fails, none of them must be appended.
275
l.extend([sideeffect(4), fail(5), sideeffect(6)])
276
except TypeError as e:
278
assert "HUHU" in str(e)
283
l.extend([sideeffect(7), sideeffect(8), fail(9)])
284
except TypeError as e:
286
assert "HUHU" in str(e)
290
l.extend([10,11,12,13,14,15,16])
296
def test_none_list_extend(list l):
298
>>> test_none_list_extend([])
300
>>> test_none_list_extend([0, 0, 0])
302
>>> test_none_list_extend(None)
307
except AttributeError: