5 _fields_
= [("a", c_int
),
10 result
= super(X
, cls
).__new
__(cls
)
11 result
.new_was_called
= True
22 class InitTest(unittest
.TestCase
):
24 # make sure the only accessing a nested structure
25 # doesn't call the structure's __new__ and __init__
27 self
.assertEqual((y
.x
.a
, y
.x
.b
), (0, 0))
28 self
.assertEqual(y
.x
.new_was_called
, False)
30 # But explicitely creating an X structure calls __new__ and __init__, of course.
32 self
.assertEqual((x
.a
, x
.b
), (9, 12))
33 self
.assertEqual(x
.new_was_called
, True)
36 self
.assertEqual((y
.x
.a
, y
.x
.b
), (9, 12))
37 self
.assertEqual(y
.x
.new_was_called
, False)
39 if __name__
== "__main__":