generated from coulomb/repo-seed
Repo stats and features as aggregates
This commit is contained in:
@@ -208,3 +208,39 @@ def test_candidate_generator_uses_generic_io_for_unknown_interfaces():
|
||||
capability = graph[0].capabilities[0]
|
||||
assert capability.inputs == ["caller input"]
|
||||
assert capability.outputs == ["callable interface result"]
|
||||
|
||||
|
||||
def test_candidate_generator_groups_many_interface_facts_into_behavioral_features():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="Registry",
|
||||
url="/tmp/registry",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(1, "documentation", "README", "README.md"),
|
||||
fact(2, "interface", "python route decorator", "src/api.py", '@app.get("/repos")'),
|
||||
fact(3, "interface", "python route decorator", "src/api.py", '@app.post("/repos")'),
|
||||
fact(
|
||||
4,
|
||||
"interface",
|
||||
"python route decorator",
|
||||
"src/api.py",
|
||||
'@app.post("/repos/{repository_id}/analysis-runs")',
|
||||
),
|
||||
fact(5, "test", "test_api.py", "tests/test_api.py"),
|
||||
]
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts)
|
||||
|
||||
capability = graph[0].capabilities[0]
|
||||
assert len(capability.features) == 1
|
||||
feature = capability.features[0]
|
||||
assert feature.name == (
|
||||
"HTTP API surface: GET /repos, POST /repos, POST /repos/{repository_id}/analysis-runs"
|
||||
)
|
||||
assert feature.type == "API"
|
||||
assert feature.location == "src/api.py"
|
||||
assert len(feature.source_refs) == 3
|
||||
|
||||
Reference in New Issue
Block a user