generated from coulomb/repo-seed
Improved candidate feature naming
This commit is contained in:
@@ -56,6 +56,7 @@ def test_candidate_generator_builds_review_seed_from_observed_facts():
|
||||
assert interface_capability.name == "Expose Repository Interface"
|
||||
assert interface_capability.confidence == 0.75
|
||||
assert interface_capability.features[0].type == "API"
|
||||
assert interface_capability.features[0].name == "POST /classify"
|
||||
assert interface_capability.features[0].location == "app.py"
|
||||
assert interface_capability.evidence[0].strength == "strong"
|
||||
|
||||
@@ -140,3 +141,44 @@ def test_candidate_confidence_scoring_increases_with_supporting_facts():
|
||||
assert graph[0].confidence == 1.0
|
||||
assert graph[0].capabilities[0].confidence == 0.85
|
||||
assert graph[0].capabilities[1].confidence == 0.75
|
||||
|
||||
|
||||
def test_candidate_generator_names_cli_features_from_nearby_function():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="CliTool",
|
||||
url="/tmp/cli-tool",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(1, "documentation", "README", "README.md"),
|
||||
ObservedFact(
|
||||
id=2,
|
||||
repository_id=1,
|
||||
analysis_run_id=1,
|
||||
snapshot_id=1,
|
||||
kind="interface",
|
||||
path="cli.py",
|
||||
name="python CLI command decorator",
|
||||
value="@click.command()",
|
||||
metadata={"line": 3},
|
||||
),
|
||||
]
|
||||
chunks = [
|
||||
chunk(
|
||||
1,
|
||||
"interface",
|
||||
"cli.py",
|
||||
"@click.command()\ndef import_repositories():\n pass",
|
||||
start_line=3,
|
||||
end_line=5,
|
||||
)
|
||||
]
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts, chunks)
|
||||
|
||||
feature = graph[0].capabilities[0].features[0]
|
||||
assert feature.type == "CLI"
|
||||
assert feature.name == "CLI command import_repositories"
|
||||
|
||||
Reference in New Issue
Block a user