Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_unicode.StringTestCase Class Reference
Inheritance diagram for ctypes.test.test_unicode.StringTestCase:
Inheritance graph
[legend]
Collaboration diagram for ctypes.test.test_unicode.StringTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_func
def test_buffers
def test_wcslen

Detailed Description

Definition at line 34 of file test_unicode.py.


Member Function Documentation

Definition at line 35 of file test_unicode.py.

00035 
00036         def setUp(self):
00037             func.argtypes = [ctypes.c_char_p]
00038             func.restype = ctypes.c_char_p

Here is the caller graph for this function:

Definition at line 39 of file test_unicode.py.

00039 
00040         def tearDown(self):
00041             func.argtypes = None
00042             func.restype = ctypes.c_int

Here is the caller graph for this function:

Reimplemented from ctypes.test.test_unicode.UnicodeTestCase.

Definition at line 46 of file test_unicode.py.

00046 
00047         def test_buffers(self):
00048             buf = ctypes.create_string_buffer(b"abc")
00049             self.assertEqual(len(buf), 3+1)
00050 
00051             buf = ctypes.create_string_buffer(b"ab\xe4\xf6\xfc")
00052             self.assertEqual(buf[:], b"ab\xe4\xf6\xfc\0")
00053             self.assertEqual(buf[::], b"ab\xe4\xf6\xfc\0")
00054             self.assertEqual(buf[::-1], b'\x00\xfc\xf6\xe4ba')
00055             self.assertEqual(buf[::2], b'a\xe4\xfc')
00056             self.assertEqual(buf[6:5:-1], b"")
00057 

Here is the call graph for this function:

Definition at line 43 of file test_unicode.py.

00043 
00044         def test_func(self):
00045             self.assertEqual(func(b"abc\xe4"), b"abc\xe4")

Here is the call graph for this function:

Definition at line 12 of file test_unicode.py.

00012 
00013         def test_wcslen(self):
00014             dll = ctypes.CDLL(_ctypes_test.__file__)
00015             wcslen = dll.my_wcslen
00016             wcslen.argtypes = [ctypes.c_wchar_p]
00017 
00018             self.assertEqual(wcslen("abc"), 3)
00019             self.assertEqual(wcslen("ab\u2070"), 3)
00020             self.assertRaises(ctypes.ArgumentError, wcslen, b"ab\xe4")

Here is the call graph for this function:


The documentation for this class was generated from the following file: