From: Stefan Behnel Date: Mon, 26 Oct 2009 08:43:14 +0000 (+0100) Subject: extended test case X-Git-Tag: 0.12.alpha0~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=df949a4dd7d0ccc78fc6e0e2e7fe2599050b2951;p=cython.git extended test case --- diff --git a/tests/run/carray_slicing.pyx b/tests/run/carray_slicing.pyx index 54f093fd..29ba2330 100644 --- a/tests/run/carray_slicing.pyx +++ b/tests/run/carray_slicing.pyx @@ -17,6 +17,15 @@ def slice_charptr_decode(): cstring[:3].decode('UTF-8'), cstring[:9].decode('UTF-8')) +def slice_charptr_decode_unbound(): + """ + >>> print str(slice_charptr_decode_unbound()).replace("u'", "'") + ('a', 'abc', 'abcABCqtp') + """ + return (bytes.decode(cstring[:1], 'UTF-8'), + bytes.decode(cstring[:3], 'UTF-8', 'replace'), + bytes.decode(cstring[:9], 'UTF-8')) + def slice_charptr_decode_errormode(): """ >>> print str(slice_charptr_decode_errormode()).replace("u'", "'") @@ -25,3 +34,14 @@ def slice_charptr_decode_errormode(): return (cstring[:1].decode('UTF-8', 'strict'), cstring[:3].decode('UTF-8', 'replace'), cstring[:9].decode('UTF-8', 'unicode_escape')) + +def slice_charptr_for_loop(): + """ + >>> slice_charptr_for_loop() + ['a', 'b', 'c'] + ['b', 'c', 'A', 'B'] + ['B', 'C', 'q', 't', 'p'] + """ + print str([ c for c in cstring[:3] ]).replace(" b'", "'").replace("[b'", "'") + print str([ c for c in cstring[1:5] ]).replace(" b'", "'").replace("[b'", "'") + print str([ c for c in cstring[4:9] ]).replace(" b'", "'")