From 4658cbdccf2560be2b468de035e0919b7049a4ed Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 9 Sep 2010 13:19:01 +0200 Subject: [PATCH] test readability --- tests/run/carray_slicing.pyx | 52 +++++++++++++----------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/tests/run/carray_slicing.pyx b/tests/run/carray_slicing.pyx index 799d7372..589ff3d3 100644 --- a/tests/run/carray_slicing.pyx +++ b/tests/run/carray_slicing.pyx @@ -48,41 +48,25 @@ def slice_charptr_for_loop_c(): def slice_charptr_for_loop_c_step(): """ >>> slice_charptr_for_loop_c_step() - Acba - ['A', 'c', 'b', 'a'] - Acba - ['A', 'c', 'b', 'a'] - bA - ['b', 'A'] - acB - ['a', 'c', 'B'] - acB - ['a', 'c', 'B'] - - [] - ptqC - ['p', 't', 'q', 'C'] - pq - ['p', 'q'] - """ - cdef unicode ustring = cstring.decode('ASCII') + Acba ['A', 'c', 'b', 'a'] + Acba ['A', 'c', 'b', 'a'] + bA ['b', 'A'] + acB ['a', 'c', 'B'] + acB ['a', 'c', 'B'] + [] + ptqC ['p', 't', 'q', 'C'] + pq ['p', 'q'] + """ + cdef object ustring = cstring.decode('ASCII') cdef char c - print ustring[3::-1] - print [ chr(c) for c in cstring[3::-1] ] - print ustring[3:None:-1] - print [ chr(c) for c in cstring[3:None:-1] ] - print ustring[1:5:2] - print [ chr(c) for c in cstring[1:5:2] ] - print ustring[:5:2] - print [ chr(c) for c in cstring[:5:2] ] - print ustring[None:5:2] - print [ chr(c) for c in cstring[None:5:2] ] - print ustring[4:9:-1] - print [ chr(c) for c in cstring[4:9:-1] ] - print ustring[8:4:-1] - print [ chr(c) for c in cstring[8:4:-1] ] - print ustring[8:4:-2] - print [ chr(c) for c in cstring[8:4:-2] ] + print ustring[3::-1], [ chr(c) for c in cstring[3::-1] ] + print ustring[3:None:-1], [ chr(c) for c in cstring[3:None:-1] ] + print ustring[1:5:2], [ chr(c) for c in cstring[1:5:2] ] + print ustring[:5:2], [ chr(c) for c in cstring[:5:2] ] + print ustring[None:5:2], [ chr(c) for c in cstring[None:5:2] ] + print ustring[4:9:-1], [ chr(c) for c in cstring[4:9:-1] ] + print ustring[8:4:-1], [ chr(c) for c in cstring[8:4:-1] ] + print ustring[8:4:-2], [ chr(c) for c in cstring[8:4:-2] ] @cython.test_assert_path_exists("//ForFromStatNode", "//ForFromStatNode//IndexNode") -- 2.26.2