54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
|
|
"""Schachstellen-Erkennung für unified Slot-Review."""
|
||
|
|
from planning_exercise_path_builder import (
|
||
|
|
_problematic_slots_from_path_qa,
|
||
|
|
_slot_suggestion_accepted,
|
||
|
|
)
|
||
|
|
from planning_progression_roadmap import StageSpecArtifact
|
||
|
|
|
||
|
|
|
||
|
|
def _spec(midx: int) -> StageSpecArtifact:
|
||
|
|
return StageSpecArtifact(
|
||
|
|
major_step_index=midx,
|
||
|
|
learning_goal=f"Lernziel Slot {midx + 1}",
|
||
|
|
load_profile=[],
|
||
|
|
exercise_type="",
|
||
|
|
success_criteria=[],
|
||
|
|
anti_patterns=[],
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_problematic_slots_from_optimization_hints():
|
||
|
|
qa = {
|
||
|
|
"optimization_hints": [
|
||
|
|
{
|
||
|
|
"action": "rematch_slot",
|
||
|
|
"step_index": 1,
|
||
|
|
"issue": "stage_mismatch",
|
||
|
|
"reason": "Übung passt nicht zur Stufe",
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"off_topic_steps": [],
|
||
|
|
}
|
||
|
|
steps = [
|
||
|
|
{"roadmap_major_step_index": 0, "exercise_id": 1, "title": "A"},
|
||
|
|
{"roadmap_major_step_index": 1, "exercise_id": 2, "title": "B"},
|
||
|
|
]
|
||
|
|
specs = [_spec(0), _spec(1)]
|
||
|
|
problems = _problematic_slots_from_path_qa(qa, steps, specs)
|
||
|
|
assert 1 in problems
|
||
|
|
assert any("Stufe" in r or "passt" in r for r in problems[1])
|
||
|
|
|
||
|
|
|
||
|
|
def test_slot_suggestion_accepted_for_problem_slot():
|
||
|
|
diff = {"baseline_exercise_id": 10, "proposed_exercise_id": 99}
|
||
|
|
assert _slot_suggestion_accepted(
|
||
|
|
baseline_qa={"optimization_hints": [{"action": "rematch_slot", "roadmap_major_step_index": 1}]},
|
||
|
|
projected_qa={"optimization_hints": []},
|
||
|
|
baseline_score=0.7,
|
||
|
|
projected_score=0.7,
|
||
|
|
diff=diff,
|
||
|
|
off_topic=False,
|
||
|
|
major_idx=1,
|
||
|
|
slot_problem=True,
|
||
|
|
)
|