introspection
This commit is contained in:
20
tests/introspection/test_functions_and_signatures.py
Normal file
20
tests/introspection/test_functions_and_signatures.py
Normal 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
|
||||
Reference in New Issue
Block a user