+cimport cython
+
cdef char* cstring = "abcABCqtp"
def slice_charptr_end():
"""
return cstring[:1], cstring[:3], cstring[:9]
+@cython.test_assert_path_exists("//PythonCapiCallNode")
+@cython.test_fail_if_path_exists("//AttributeNode")
def slice_charptr_decode():
"""
>>> print str(slice_charptr_decode()).replace("u'", "'")
cstring[:3].decode('UTF-8'),
cstring[:9].decode('UTF-8'))
+@cython.test_assert_path_exists("//PythonCapiCallNode")
+@cython.test_fail_if_path_exists("//AttributeNode")
def slice_charptr_decode_unbound():
"""
>>> print str(slice_charptr_decode_unbound()).replace("u'", "'")
bytes.decode(cstring[:3], 'UTF-8', 'replace'),
bytes.decode(cstring[:9], 'UTF-8'))
+@cython.test_assert_path_exists("//PythonCapiCallNode")
+@cython.test_fail_if_path_exists("//AttributeNode")
def slice_charptr_decode_errormode():
"""
>>> print str(slice_charptr_decode_errormode()).replace("u'", "'")