From: Robert Bradshaw Date: Tue, 14 Jul 2009 07:17:26 +0000 (-0700) Subject: more delete tests X-Git-Tag: 0.12.alpha0~224^2~1^2^2~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=51d654879fcd939878034a9b12496ace868ccfab;p=cython.git more delete tests --- diff --git a/tests/run/delete.pyx b/tests/run/delete.pyx index 50c41036..917df2fc 100644 --- a/tests/run/delete.pyx +++ b/tests/run/delete.pyx @@ -8,6 +8,17 @@ {2: 'b'} >>> del_item(range(10), 2) [0, 1, 3, 4, 5, 6, 7, 8, 9] + +>>> del_dict({1: 'a', 2: 'b'}, 1) +{2: 'b'} +>>> del_list(range(5), 3) +[0, 1, 2, 4] +>>> del_int(range(5), 3) +[0, 1, 2, 4] +>>> del_list_int(range(5), 3) +[0, 1, 2, 4] +>>> del_int({-1: 'neg', 1: 'pos'}, -1) +{1: 'pos'} """ class A: @@ -24,3 +35,19 @@ class A: def del_item(L, o): del L[o] return L + +def del_dict(dict D, o): + del D[o] + return D + +def del_list(list L, o): + del L[o] + return L + +def del_int(L, int i): + del L[i] + return L + +def del_list_int(L, int i): + del L[i] + return L