introspection

This commit is contained in:
2026-01-20 20:24:22 +05:30
parent c910da9d14
commit 102ea4e215
26 changed files with 525 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
from docforge import GriffeLoader
def test_function_signature(temp_package):
(temp_package / "fn.py").write_text(
'''def add(a: int, b: int = 1) -> int:
"""Adds numbers."""
return a + b
'''
)
loader = GriffeLoader()
project = loader.load_project(["testpkg.fn"])
module = project.get_module("testpkg.fn")
fn = module.get_object("add")
assert fn.kind == "function"
assert fn.signature is not None
assert "a" in fn.signature
assert "b" in fn.signature