def test_unique_nodelete(): from pybind11_tests import MyObject4 o = MyObject4(23) assert o.value == 23 cstats = ConstructorStats.get(MyObject4) assert cstats.alive() == 1 del o cstats = ConstructorStats.get(MyObject4) assert cstats.alive() == 1 # Leak, but that's intentional
def test_unique_nodelete(): from pybind11_tests import MyObject4 o = MyObject4(23) if o.value != 23: raise AssertionError cstats = ConstructorStats.get(MyObject4) if cstats.alive() != 1: raise AssertionError del o cstats = ConstructorStats.get(MyObject4) if cstats.alive() != 1: raise AssertionError