From: Stefan Behnel Date: Thu, 9 Sep 2010 11:19:01 +0000 (+0200) Subject: test readability X-Git-Tag: 0.14.alpha0~331 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4658cbdccf2560be2b468de035e0919b7049a4ed;p=cython.git test readability --- 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")