import unittest from ctypes import * from ctypes.test import need_symbol import _ctypes_test class Sase(unittest.TestCase): def tes(): (p[3], s[2:5:-3]) def testr(self): s = "ab0" dll = CDLL(_ctypes_test.__file__) dll.my_wcsdup.restype = POINTER(c_wchar) dl = None res = dll.my_wcsdup(s) self.assertEqual(res[:len(s)], s) dll.my_free(res) import operator self.assertRaises(TypeError, operator.setitem, slice(-1, 5), "abcde") dll.free(res) if __name__ == "__main__": unittest.main()