MCPcopy Create free account
hub / github.com/apple/coremltools / test_reference_internal

Function test_reference_internal

deps/pybind11/tests/test_modules.py:28–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27
28def test_reference_internal():
29 b = ms.B()
30 assert str(b.get_a1()) == "A[1]"
31 assert str(b.a1) == "A[1]"
32 assert str(b.get_a2()) == "A[2]"
33 assert str(b.a2) == "A[2]"
34
35 b.a1 = ms.A(42)
36 b.a2 = ms.A(43)
37 assert str(b.get_a1()) == "A[42]"
38 assert str(b.a1) == "A[42]"
39 assert str(b.get_a2()) == "A[43]"
40 assert str(b.a2) == "A[43]"
41
42 astats, bstats = ConstructorStats.get(ms.A), ConstructorStats.get(ms.B)
43 assert astats.alive() == 2
44 assert bstats.alive() == 1
45 del b
46 assert astats.alive() == 0
47 assert bstats.alive() == 0
48 assert astats.values() == ["1", "2", "42", "43"]
49 assert bstats.values() == []
50 assert astats.default_constructions == 0
51 assert bstats.default_constructions == 1
52 assert astats.copy_constructions == 0
53 assert bstats.copy_constructions == 0
54 # assert astats.move_constructions >= 0 # Don't invoke any
55 # assert bstats.move_constructions >= 0 # Don't invoke any
56 assert astats.copy_assignments == 2
57 assert bstats.copy_assignments == 0
58 assert astats.move_assignments == 0
59 assert bstats.move_assignments == 0
60
61
62def test_importing():

Callers

nothing calls this directly

Calls 6

aliveMethod · 0.80
getMethod · 0.65
strClass · 0.50
BMethod · 0.45
AMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected