Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_internals.ObjectsTestCase Class Reference

List of all members.

Public Member Functions

def assertSame
def test_ints
def test_c_char_p
def test_simple_struct
def test_embedded_structs
def test_xxx

Detailed Description

Definition at line 20 of file test_internals.py.


Member Function Documentation

Definition at line 21 of file test_internals.py.

00021 
00022     def assertSame(self, a, b):
00023         self.assertEqual(id(a), id(b))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 31 of file test_internals.py.

00031 
00032     def test_c_char_p(self):
00033         s = b"Hello, World"
00034         refcnt = grc(s)
00035         cs = c_char_p(s)
00036         self.assertEqual(refcnt + 1, grc(s))
00037         self.assertSame(cs._objects, s)

Here is the call graph for this function:

Definition at line 50 of file test_internals.py.

00050 
00051     def test_embedded_structs(self):
00052         class X(Structure):
00053             _fields_ = [("a", c_int), ("b", c_int)]
00054 
00055         class Y(Structure):
00056             _fields_ = [("x", X), ("y", X)]
00057 
00058         y = Y()
00059         self.assertEqual(y._objects, None)
00060 
00061         x1, x2 = X(), X()
00062         y.x, y.y = x1, x2
00063         self.assertEqual(y._objects, {"0": {}, "1": {}})
00064         x1.a, x2.b = 42, 93
00065         self.assertEqual(y._objects, {"0": {}, "1": {}})

Here is the call graph for this function:

Definition at line 24 of file test_internals.py.

00024 
00025     def test_ints(self):
00026         i = 42000123
00027         refcnt = grc(i)
00028         ci = c_int(i)
00029         self.assertEqual(refcnt, grc(i))
00030         self.assertEqual(ci._objects, None)

Here is the call graph for this function:

Definition at line 38 of file test_internals.py.

00038 
00039     def test_simple_struct(self):
00040         class X(Structure):
00041             _fields_ = [("a", c_int), ("b", c_int)]
00042 
00043         a = 421234
00044         b = 421235
00045         x = X()
00046         self.assertEqual(x._objects, None)
00047         x.a = a
00048         x.b = b
00049         self.assertEqual(x._objects, None)

Here is the call graph for this function:

Definition at line 66 of file test_internals.py.

00066 
00067     def test_xxx(self):
00068         class X(Structure):
00069             _fields_ = [("a", c_char_p), ("b", c_char_p)]
00070 
00071         class Y(Structure):
00072             _fields_ = [("x", X), ("y", X)]
00073 
00074         s1 = b"Hello, World"
00075         s2 = b"Hallo, Welt"
00076 
00077         x = X()
00078         x.a = s1
00079         x.b = s2
00080         self.assertEqual(x._objects, {"0": s1, "1": s2})
00081 
00082         y = Y()
00083         y.x = x
        self.assertEqual(y._objects, {"0": {"0": s1, "1": s2}})

Here is the call graph for this function:


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