Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ import importlib

def main() -> None:
module = importlib.import_module("{{ cpp_namespace }}")

assert module.add(2, 3) == 5
assert module.__version__ == "0.1.0"
assert module.version() == "0.1.0"
assert module.__version__ == "0.1.0"
assert module.__doc__

try:
module.add("2", 3)
except TypeError:
pass
else:
raise AssertionError("add() should reject non-integer arguments")


if __name__ == "__main__":
Expand Down
4 changes: 4 additions & 0 deletions tests/test_template/test_cpp_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def test_cpp_template_renders_spinach_style_structure(tmp_path: Path) -> None:
assert "option('build_python_bindings'" in meson_options
assert '"pybind11>=2.13.6"' in pyproject
assert 'module.attr("__version__") = sample_cpp::version();' in python_bindings
assert 'module.add(2, 3) == 5' in python_bindings_test
assert 'module.version() == "0.1.0"' in python_bindings_test
assert 'module.__version__ == "0.1.0"' in python_bindings_test
assert "assert module.__doc__" in python_bindings_test
assert "except TypeError:" in python_bindings_test
assert "PYTHONPATH=build uv run python" in readme
assert "make check-docs" in github_ci
assert "make check" in github_ci
Expand Down
Loading