def test_function_type(self): def stringObj(c_ptr): char_ptr = ctypes.c_char_p(c_ptr) python_string = char_ptr.value TestUtilPrototype.lib.free(c_ptr) return python_string Prototype.registerType("string_obj", stringObj) dateStamp = TestUtilPrototype("string_obj util_alloc_date_stamp()") date_stamp = dateStamp() self.assertIsInstance(date_stamp, str)
def test_already_registered(self): with self.assertRaises(PrototypeError): Prototype.registerType("test_stringlist", None)