Wenzel Jakob | 5708221 | 2015-09-04 23:42:12 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | from __future__ import print_function |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 3 | import sys |
| 4 | sys.path.append('.') |
| 5 | |
| 6 | import example |
| 7 | |
| 8 | print(example.__name__) |
| 9 | print(example.submodule.__name__) |
| 10 | |
| 11 | from example.submodule import * |
Wenzel Jakob | db028d6 | 2015-10-13 23:44:25 +0200 | [diff] [blame] | 12 | from example import OD |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 13 | |
| 14 | submodule_func() |
| 15 | |
| 16 | b = B() |
| 17 | print(b.get_a1()) |
| 18 | print(b.a1) |
| 19 | print(b.get_a2()) |
| 20 | print(b.a2) |
| 21 | |
| 22 | b.a1 = A(42) |
| 23 | b.a2 = A(43) |
| 24 | |
| 25 | print(b.get_a1()) |
| 26 | print(b.a1) |
| 27 | print(b.get_a2()) |
| 28 | print(b.a2) |
| 29 | |
Wenzel Jakob | db028d6 | 2015-10-13 23:44:25 +0200 | [diff] [blame] | 30 | print(OD([(1, 'a'), (2, 'b')])) |
Jason Rhinelander | 3f58937 | 2016-08-07 13:05:26 -0400 | [diff] [blame] | 31 | |
| 32 | from example import ConstructorStats |
| 33 | |
| 34 | cstats = [ConstructorStats.get(A), ConstructorStats.get(B)] |
| 35 | print("Instances not destroyed:", [x.alive() for x in cstats]) |
| 36 | b = None |
| 37 | print("Instances not destroyed:", [x.alive() for x in cstats]) |
| 38 | print("Constructor values:", [x.values() for x in cstats]) |
| 39 | print("Default constructions:", [x.default_constructions for x in cstats]) |
| 40 | print("Copy constructions:", [x.copy_constructions for x in cstats]) |
| 41 | #print("Move constructions:", [x.move_constructions >= 0 for x in cstats]) # Don't invoke any |
| 42 | print("Copy assignments:", [x.copy_assignments for x in cstats]) |
| 43 | print("Move assignments:", [x.move_assignments for x in cstats]) |