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

Function test_override_ref

tests/test_virtual_functions.py:300–313  ·  view source on GitHub ↗

#392/397: overriding reference-returning functions

()

Source from the content-addressed store, hash-verified

298
299
300def test_override_ref():
301 """#392/397: overriding reference-returning functions"""
302 o = m.OverrideTest("asdf")
303
304 # Not allowed (see associated .cpp comment)
305 # i = o.str_ref()
306 # assert o.str_ref() == "asdf"
307 assert o.str_value() == "asdf"
308
309 assert o.A_value().value == "hi"
310 a = o.A_ref()
311 assert a.value == "hi"
312 a.value = "bye"
313 assert a.value == "bye"
314
315
316def test_inherited_virtuals():

Callers

nothing calls this directly

Calls 3

str_valueMethod · 0.95
A_valueMethod · 0.95
OverrideTestMethod · 0.80

Tested by

no test coverage detected