mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-22 14:57:07 +08:00
Use simple asserts and pytest's powerful introspection to make testing simpler. This merges the old .py/.ref file pairs into simple .py files where the expected values are right next to the code being tested. This commit does not touch the C++ part of the code and replicates the Python tests exactly like the old .ref-file-based approach.
9 lines
288 B
Python
9 lines
288 B
Python
|
|
|
|
def test_automatic_upcasting():
|
|
from pybind11_tests import return_class_1, return_class_2, return_none
|
|
|
|
assert type(return_class_1()).__name__ == "DerivedClass1"
|
|
assert type(return_class_2()).__name__ == "DerivedClass2"
|
|
assert type(return_none()).__name__ == "NoneType"
|