Test and document binding protected member functions
diff --git a/tests/test_class.py b/tests/test_class.py
index 9c5049f..c8ff857 100644
--- a/tests/test_class.py
+++ b/tests/test_class.py
@@ -176,3 +176,22 @@
"C delete " + sz_noalias + "\n" +
"C delete " + sz_alias + "\n"
)
+
+
+def test_bind_protected_functions():
+ """Expose protected member functions to Python using a helper class"""
+ a = m.ProtectedA()
+ assert a.foo() == 42
+
+ b = m.ProtectedB()
+ assert b.foo() == 42
+
+ class C(m.ProtectedB):
+ def __init__(self):
+ m.ProtectedB.__init__(self)
+
+ def foo(self):
+ return 0
+
+ c = C()
+ assert c.foo() == 0