MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_unique_deleter

Function test_unique_deleter

tests/test_smart_ptr.py:149–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147
148@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
149def test_unique_deleter():
150 m.MyObject4a(0)
151 o = m.MyObject4b(23)
152 assert o.value == 23
153 cstats4a = ConstructorStats.get(m.MyObject4a)
154 assert cstats4a.alive() == 2
155 cstats4b = ConstructorStats.get(m.MyObject4b)
156 assert cstats4b.alive() == 1
157 del o
158 assert cstats4a.alive() == 1 # Should now only be one leftover
159 assert cstats4b.alive() == 0 # Should be deleted
160 m.MyObject4a.cleanup_all_instances()
161 assert cstats4a.alive() == 0
162 assert cstats4b.alive() == 0
163
164
165@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")

Callers

nothing calls this directly

Calls 4

MyObject4aMethod · 0.80
MyObject4bMethod · 0.80
aliveMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected