From 13ed93192896d99f942e3c8365aff0057d7b0583 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 19 Dec 2010 19:46:22 +0100 Subject: [PATCH] test cleanup --- tests/run/delete.pyx | 55 ++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/tests/run/delete.pyx b/tests/run/delete.pyx index be7c40f9..b0626581 100644 --- a/tests/run/delete.pyx +++ b/tests/run/delete.pyx @@ -1,27 +1,12 @@ -""" ->>> a = A() ->>> a.f() -[2, 1] ->>> a.g() -(False, True) ->>> del_item({1: 'a', 2: 'b'}, 1) -{2: 'b'} ->>> del_item(list(range(10)), 2) -[0, 1, 3, 4, 5, 6, 7, 8, 9] ->>> del_dict({1: 'a', 2: 'b'}, 1) -{2: 'b'} ->>> del_list(list(range(5)), 3) -[0, 1, 2, 4] ->>> del_int(list(range(5)), 3) -[0, 1, 2, 4] ->>> del_list_int(list(range(5)), 3) -[0, 1, 2, 4] ->>> del_int({-1: 'neg', 1: 'pos'}, -1) -{1: 'pos'} -""" - -class A: +class A(object): + """ + >>> a = A() + >>> a.f() + [2, 1] + >>> a.g() + (False, True) + """ def f(self): self.refs = [3,2,1] del self.refs[0] @@ -33,21 +18,45 @@ class A: return (hasattr(self, u"a"), hasattr(self, u"g")) def del_item(L, o): + """ + >>> del_item({1: 'a', 2: 'b'}, 1) + {2: 'b'} + >>> del_item(list(range(10)), 2) + [0, 1, 3, 4, 5, 6, 7, 8, 9] + """ del L[o] return L def del_dict(dict D, o): + """ + >>> del_dict({1: 'a', 2: 'b'}, 1) + {2: 'b'} + """ del D[o] return D def del_list(list L, o): + """ + >>> del_list(list(range(5)), 3) + [0, 1, 2, 4] + """ del L[o] return L def del_int(L, int i): + """ + >>> del_int(list(range(5)), 3) + [0, 1, 2, 4] + >>> del_int({-1: 'neg', 1: 'pos'}, -1) + {1: 'pos'} + """ del L[i] return L def del_list_int(L, int i): + """ + >>> del_list_int(list(range(5)), 3) + [0, 1, 2, 4] + """ del L[i] return L -- 2.26.2