All checks were successful
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m13s
- Added `planning_context` to the `suggestExerciseAi` endpoint, enabling structured planning context for new exercise creation. - Updated relevant components and backend logic to handle the new planning context, enhancing the AI's exercise suggestion capabilities. - Incremented application version to 0.8.208 to reflect these changes.
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
"""Tests Planungs-KI Phase D — planning_context für suggestExerciseAi."""
|
|
from planning_exercise_form_context import (
|
|
build_progression_path_gap_planning_context,
|
|
planning_context_prompt_variables,
|
|
sanitize_planning_context_for_ai,
|
|
)
|
|
|
|
|
|
def test_planning_context_prompt_variables_empty():
|
|
vars_ = planning_context_prompt_variables(None)
|
|
assert vars_["planning_context_json"] == "-"
|
|
assert vars_["has_planning_context"] == ""
|
|
|
|
|
|
def test_planning_context_prompt_variables_with_data():
|
|
vars_ = planning_context_prompt_variables({"source": "test", "goal_query": "Mae Geri"})
|
|
assert vars_["has_planning_context"] == "true"
|
|
assert "Mae Geri" in vars_["planning_context_json"]
|
|
|
|
|
|
def test_build_progression_path_gap_context():
|
|
ctx = build_progression_path_gap_planning_context(
|
|
goal_query="Mae Geri Perfektion",
|
|
primary_topic="Mae Geri",
|
|
progression_graph_id=3,
|
|
offer={
|
|
"source": "roadmap_unfilled",
|
|
"phase": "vertiefung",
|
|
"title_hint": "Koordination Mae Geri",
|
|
"roadmap_major_step_index": 2,
|
|
"from_title": "Schritt A",
|
|
"to_title": "Schritt B",
|
|
},
|
|
neighbor_before={"title": "Schritt A"},
|
|
neighbor_after={"title": "Schritt B"},
|
|
path_step_count=4,
|
|
major_step_count=5,
|
|
)
|
|
assert ctx["source"] == "progression_path_gap_fill"
|
|
assert ctx["roadmap_major_step_index"] == 2
|
|
assert ctx["neighbor_before_title"] == "Schritt A"
|
|
|
|
|
|
def test_sanitize_truncates_long_strings():
|
|
ctx = sanitize_planning_context_for_ai({"goal_query": "x" * 900})
|
|
assert len(ctx["goal_query"]) <= 800
|