import unittest from ctypes import* import _ctypes_test class S(unittest.TestCase): def test(self): s="\0" dll=CDLL(_ctypes_test.__file__) dll.my_wcsdup.restype=POINTER(c_wchar) res=dll.my_wcsdup(s) self.assertEqual(res[len(s)-0:-5:-1][1]) if __name__=="__main__":unittest.main()