2026-06-08 12:40:17 +02:00
|
|
|
"""Tests Planungs-KI Phase C3/E/F — Pfad-Vorschläge."""
|
|
|
|
|
from planning_exercise_path_builder import (
|
|
|
|
|
_annotate_roadmap_step,
|
|
|
|
|
_hit_to_path_step,
|
|
|
|
|
_pick_best_path_hit,
|
|
|
|
|
)
|
|
|
|
|
from planning_progression_roadmap import MajorStep, StageSpecArtifact
|
2026-05-23 11:46:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_pick_next_path_hit_skips_used():
|
2026-05-23 12:02:57 +02:00
|
|
|
hits = [{"id": 1, "title": "A", "semantic_score": 0.2}, {"id": 2, "title": "B", "semantic_score": 0.2}, {"id": 3, "title": "C", "semantic_score": 0.2}]
|
|
|
|
|
assert _pick_best_path_hit(hits, {1})["id"] == 2
|
|
|
|
|
assert _pick_best_path_hit(hits, {1, 2, 3}) is None
|
2026-05-23 11:46:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_hit_to_path_step_maps_variant():
|
|
|
|
|
step = _hit_to_path_step(
|
|
|
|
|
{
|
|
|
|
|
"id": 10,
|
|
|
|
|
"title": "Test",
|
|
|
|
|
"score": 0.8,
|
|
|
|
|
"reasons": ["Graph"],
|
|
|
|
|
"suggested_variant_id": 7,
|
|
|
|
|
"suggested_variant_name": "Leicht",
|
|
|
|
|
"variants": [{"id": 7, "variant_name": "Leicht"}],
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
assert step["exercise_id"] == 10
|
|
|
|
|
assert step["variant_id"] == 7
|
|
|
|
|
assert step["suggested_variant_name"] == "Leicht"
|
2026-06-08 12:40:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_annotate_roadmap_step_adds_metadata():
|
|
|
|
|
spec = StageSpecArtifact(major_step_index=1, learning_goal="Grundstellung Mae Geri")
|
|
|
|
|
major = MajorStep(index=1, phase="grundlage", learning_goal=spec.learning_goal, consolidates=["m1"])
|
|
|
|
|
step = _annotate_roadmap_step(
|
|
|
|
|
{"exercise_id": 5, "title": "Test", "reasons": ["Bibliothek"]},
|
|
|
|
|
stage_spec=spec,
|
|
|
|
|
major_step=major,
|
|
|
|
|
)
|
|
|
|
|
assert step["roadmap_major_step_index"] == 1
|
|
|
|
|
assert step["roadmap_phase"] == "grundlage"
|
|
|
|
|
assert step["roadmap_match_source"] == "stage_spec"
|
|
|
|
|
assert any("Roadmap:" in r for r in step["reasons"])
|