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

Function test_automatic_upcasting

tests/test_class.py:266–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

264
265
266def test_automatic_upcasting():
267 assert type(m.return_class_1()).__name__ == "DerivedClass1"
268 assert type(m.return_class_2()).__name__ == "DerivedClass2"
269 assert type(m.return_none()).__name__ == "NoneType"
270 # Repeat these a few times in a random order to ensure no invalid caching is applied
271 assert type(m.return_class_n(1)).__name__ == "DerivedClass1"
272 assert type(m.return_class_n(2)).__name__ == "DerivedClass2"
273 assert type(m.return_class_n(0)).__name__ == "BaseClass"
274 assert type(m.return_class_n(2)).__name__ == "DerivedClass2"
275 assert type(m.return_class_n(2)).__name__ == "DerivedClass2"
276 assert type(m.return_class_n(0)).__name__ == "BaseClass"
277 assert type(m.return_class_n(1)).__name__ == "DerivedClass1"
278
279
280def test_isinstance():

Callers

nothing calls this directly

Calls 1

typeClass · 0.50

Tested by

no test coverage detected