mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
d6df11602b
- Useful for object hierarchies that don't use C++ inheritance (such as GObject)
24 lines
396 B
Python
24 lines
396 B
Python
from pybind11_tests import custom_base as m
|
|
|
|
|
|
def test_cb_base():
|
|
b = m.create_base()
|
|
|
|
assert isinstance(b, m.Base)
|
|
assert b.i == 5
|
|
|
|
assert m.base_i(b) == 5
|
|
|
|
|
|
def test_cb_derived():
|
|
d = m.create_derived()
|
|
|
|
assert isinstance(d, m.Derived)
|
|
assert isinstance(d, m.Base)
|
|
|
|
assert d.i == 5
|
|
assert d.j == 6
|
|
|
|
assert m.base_i(d) == 5
|
|
assert m.derived_j(d) == 6
|