Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_buffers.StringBufferTestCase Class Reference

List of all members.

Public Member Functions

def test_buffer
def test_buffer_interface
def test_unicode_buffer
def test_unicode_conversion

Detailed Description

Definition at line 4 of file test_buffers.py.


Member Function Documentation

Definition at line 6 of file test_buffers.py.

00006 
00007     def test_buffer(self):
00008         b = create_string_buffer(32)
00009         self.assertEqual(len(b), 32)
00010         self.assertEqual(sizeof(b), 32 * sizeof(c_char))
00011         self.assertTrue(type(b[0]) is bytes)
00012 
00013         b = create_string_buffer(b"abc")
00014         self.assertEqual(len(b), 4) # trailing nul char
00015         self.assertEqual(sizeof(b), 4 * sizeof(c_char))
00016         self.assertTrue(type(b[0]) is bytes)
00017         self.assertEqual(b[0], b"a")
00018         self.assertEqual(b[:], b"abc\0")
00019         self.assertEqual(b[::], b"abc\0")
00020         self.assertEqual(b[::-1], b"\0cba")
00021         self.assertEqual(b[::2], b"ac")
00022         self.assertEqual(b[::5], b"a")

Here is the call graph for this function:

Definition at line 23 of file test_buffers.py.

00023 
00024     def test_buffer_interface(self):
00025         self.assertEqual(len(bytearray(create_string_buffer(0))), 0)
00026         self.assertEqual(len(bytearray(create_string_buffer(1))), 1)

Here is the call graph for this function:

Definition at line 32 of file test_buffers.py.

00032 
00033         def test_unicode_buffer(self):
00034             b = create_unicode_buffer(32)
00035             self.assertEqual(len(b), 32)
00036             self.assertEqual(sizeof(b), 32 * sizeof(c_wchar))
00037             self.assertTrue(type(b[0]) is str)
00038 
00039             b = create_unicode_buffer("abc")
00040             self.assertEqual(len(b), 4) # trailing nul char
00041             self.assertEqual(sizeof(b), 4 * sizeof(c_wchar))
00042             self.assertTrue(type(b[0]) is str)
00043             self.assertEqual(b[0], "a")
00044             self.assertEqual(b[:], "abc\0")
00045             self.assertEqual(b[::], "abc\0")
00046             self.assertEqual(b[::-1], "\0cba")
00047             self.assertEqual(b[::2], "ac")
00048             self.assertEqual(b[::5], "a")

Here is the call graph for this function:

Definition at line 49 of file test_buffers.py.

00049 
00050         def test_unicode_conversion(self):
00051             b = create_unicode_buffer("abc")
00052             self.assertEqual(len(b), 4) # trailing nul char
00053             self.assertEqual(sizeof(b), 4 * sizeof(c_wchar))
00054             self.assertTrue(type(b[0]) is str)
00055             self.assertEqual(b[0], "a")
00056             self.assertEqual(b[:], "abc\0")
00057             self.assertEqual(b[::], "abc\0")
00058             self.assertEqual(b[::-1], "\0cba")
00059             self.assertEqual(b[::2], "ac")
00060             self.assertEqual(b[::5], "a")

Here is the call graph for this function:


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