Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_structures.PointerMemberTestCase Class Reference

List of all members.

Public Member Functions

def test

Detailed Description

Definition at line 371 of file test_structures.py.


Member Function Documentation

Definition at line 373 of file test_structures.py.

00373 
00374     def test(self):
00375         # a Structure with a POINTER field
00376         class S(Structure):
00377             _fields_ = [("array", POINTER(c_int))]
00378 
00379         s = S()
00380         # We can assign arrays of the correct type
00381         s.array = (c_int * 3)(1, 2, 3)
00382         items = [s.array[i] for i in range(3)]
00383         self.assertEqual(items, [1, 2, 3])
00384 
00385         # The following are bugs, but are included here because the unittests
00386         # also describe the current behaviour.
00387         #
00388         # This fails with SystemError: bad arg to internal function
00389         # or with IndexError (with a patch I have)
00390 
00391         s.array[0] = 42
00392 
00393         items = [s.array[i] for i in range(3)]
00394         self.assertEqual(items, [42, 2, 3])
00395 
00396         s.array[0] = 1

Here is the call graph for this function:

Here is the caller graph for this function:


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