Commit 8750384d authored by Thomas Heller's avatar Thomas Heller

More easy fixes. The ctypes unittests pass now (on Windows).

parent d660fabd
......@@ -166,7 +166,7 @@ class FunctionTestCase(unittest.TestCase):
f = dll._testfunc_p_p
f.argtypes = None
f.restype = c_char_p
result = f("123")
result = f(b"123")
self.failUnlessEqual(result, "123")
result = f(None)
......
......@@ -74,11 +74,11 @@ class PythonAPITestCase(unittest.TestCase):
PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p
buf = c_buffer(256)
PyOS_snprintf(buf, sizeof(buf), "Hello from %s", "ctypes")
PyOS_snprintf(buf, sizeof(buf), "Hello from %s", b"ctypes")
self.failUnlessEqual(buf.value, "Hello from ctypes")
PyOS_snprintf(buf, sizeof(buf), "Hello from %s (%d, %d, %d)", "ctypes", 1, 2, 3)
self.failUnlessEqual(buf.value, "Hello from ctypes")
PyOS_snprintf(buf, sizeof(buf), "Hello from %s (%d, %d, %d)", b"ctypes", 1, 2, 3)
self.failUnlessEqual(buf.value, "Hello from ctypes (1, 2, 3)")
# not enough arguments
self.failUnlessRaises(TypeError, PyOS_snprintf, buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment