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

Function test_instance

tests/test_class.py:40–53  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

38
39
40def test_instance(msg):
41 with pytest.raises(TypeError) as excinfo:
42 m.NoConstructor()
43 assert msg(excinfo.value) == "m.class_.NoConstructor: No constructor defined!"
44
45 instance = m.NoConstructor.new_instance()
46
47 if env.GRAALPY:
48 pytest.skip("ConstructorStats is incompatible with GraalPy.")
49
50 cstats = ConstructorStats.get(m.NoConstructor)
51 assert cstats.alive() == 1
52 del instance
53 assert cstats.alive() == 0
54
55
56@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 5

msgFunction · 0.85
NoConstructorMethod · 0.80
aliveMethod · 0.80
new_instanceMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected