From: Stefan Behnel Date: Tue, 30 Dec 2008 11:18:20 +0000 (+0100) Subject: extended test case for list.pop() X-Git-Tag: 0.11-beta~66 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=712659794e630685ada9d856af3a4630eced3f2b;p=cython.git extended test case for list.pop() --- diff --git a/tests/run/list.pyx b/tests/run/list.pyx index e5ac6aa9..b15fb2ad 100644 --- a/tests/run/list.pyx +++ b/tests/run/list.pyx @@ -9,6 +9,12 @@ __doc__ = u""" [2, 3, 4] >>> k(1, 2, 3, 4, 5) [17, 42, 88] + >>> test_list_pop() + (2, [1]) + >>> test_list_pop0() + (1, [2]) + >>> test_list_pop_all() + True """ def f(obj1, obj2, obj3, obj4, obj5): @@ -30,3 +36,26 @@ def j(obj1, obj2, obj3, obj4, obj5): def k(obj1, obj2, obj3, obj4, obj5): obj1 = [17, 42, 88] return obj1 + +def test_list_pop(): + cdef list s1 + l1 = [1,2] + two = l1.pop() + return two, l1 + +def test_list_pop0(): + cdef list s1 + l1 = [1,2] + one = l1.pop(0) + return one, l1 + +def test_list_pop_all(): + cdef list s1 + l1 = [1,2] + try: + l1.pop() + l1.pop(-1) + l1.pop(0) + except IndexError: + return True + return False