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

Function test_duplicate_local

tests/test_local_bindings.py:96–106  ·  view source on GitHub ↗

Tests expected failure when registering a class twice with py::local in the same module

()

Source from the content-addressed store, hash-verified

94
95
96def test_duplicate_local():
97 """Tests expected failure when registering a class twice with py::local in the same module"""
98 with pytest.raises(RuntimeError) as excinfo:
99 m.register_local_external()
100 import pybind11_tests
101
102 assert str(excinfo.value) == (
103 'generic_type: type "LocalExternal" is already registered!'
104 if hasattr(pybind11_tests, "class_")
105 else "test_class not enabled"
106 )
107
108
109def test_stl_bind_local():

Callers

nothing calls this directly

Calls 2

strClass · 0.85
hasattrFunction · 0.85

Tested by

no test coverage detected