Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_init.InitTest Class Reference

List of all members.

Public Member Functions

def test_get

Detailed Description

Definition at line 22 of file test_init.py.


Member Function Documentation

Definition at line 23 of file test_init.py.

00023 
00024     def test_get(self):
00025         # make sure the only accessing a nested structure
00026         # doesn't call the structure's __new__ and __init__
00027         y = Y()
00028         self.assertEqual((y.x.a, y.x.b), (0, 0))
00029         self.assertEqual(y.x.new_was_called, False)
00030 
00031         # But explicitly creating an X structure calls __new__ and __init__, of course.
00032         x = X()
00033         self.assertEqual((x.a, x.b), (9, 12))
00034         self.assertEqual(x.new_was_called, True)
00035 
00036         y.x = x
00037         self.assertEqual((y.x.a, y.x.b), (9, 12))
00038         self.assertEqual(y.x.new_was_called, False)

Here is the call graph for this function:


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