Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_keeprefs.StructureTestCase Class Reference

List of all members.

Public Member Functions

def test_cint_struct
def test_ccharp_struct
def test_struct_struct

Detailed Description

Definition at line 21 of file test_keeprefs.py.


Member Function Documentation

Definition at line 33 of file test_keeprefs.py.

00033 
00034     def test_ccharp_struct(self):
00035         class X(Structure):
00036             _fields_ = [("a", c_char_p),
00037                         ("b", c_char_p)]
00038         x = X()
00039         self.assertEqual(x._objects, None)
00040 
00041         x.a = b"spam"
00042         x.b = b"foo"
00043         self.assertEqual(x._objects, {"0": b"spam", "1": b"foo"})

Here is the call graph for this function:

Definition at line 22 of file test_keeprefs.py.

00022 
00023     def test_cint_struct(self):
00024         class X(Structure):
00025             _fields_ = [("a", c_int),
00026                         ("b", c_int)]
00027 
00028         x = X()
00029         self.assertEqual(x._objects, None)
00030         x.a = 42
00031         x.b = 99
00032         self.assertEqual(x._objects, None)

Here is the call graph for this function:

Definition at line 44 of file test_keeprefs.py.

00044 
00045     def test_struct_struct(self):
00046         class POINT(Structure):
00047             _fields_ = [("x", c_int), ("y", c_int)]
00048         class RECT(Structure):
00049             _fields_ = [("ul", POINT), ("lr", POINT)]
00050 
00051         r = RECT()
00052         r.ul.x = 0
00053         r.ul.y = 1
00054         r.lr.x = 2
00055         r.lr.y = 3
00056         self.assertEqual(r._objects, None)
00057 
00058         r = RECT()
00059         pt = POINT(1, 2)
00060         r.ul = pt
00061         self.assertEqual(r._objects, {'0': {}})
00062         r.ul.x = 22
00063         r.ul.y = 44
00064         self.assertEqual(r._objects, {'0': {}})
00065         r.lr = POINT()
00066         self.assertEqual(r._objects, {'0': {}, '1': {}})

Here is the call graph for this function:


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