From df949a4dd7d0ccc78fc6e0e2e7fe2599050b2951 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 26 Oct 2009 09:43:14 +0100 Subject: [PATCH] extended test case --- tests/run/carray_slicing.pyx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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'", "'") -- 2.26.2