shinkan-jinkendo/backend/tests/test_planning_assignment_preservation.py
Lars 5ed06002d9
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m18s
Implement Comparison Logic for Progression Path Suggestions
- Added `compare_with_assignments` flag to `ProgressionPathSuggestRequest` to enable comparison of proposed paths with existing slot assignments.
- Introduced `_assignment_preservation_active` function to determine if existing assignments should be preserved during path suggestions.
- Enhanced `suggest_progression_path` to handle comparison logic, including validation for minimum slot assignments required for comparison.
- Implemented `_build_progression_compare_response` to structure the response for comparison results, including slot differences and quality scores.
- Updated frontend components to support new comparison features, including handling of slot assignments and optimization comparisons.
- Bumped version to reflect the new features and improvements.
2026-06-12 13:22:04 +02:00

32 lines
1.1 KiB
Python

"""Tests Trainer-Pfad-Schutz (preserve_slot_assignments)."""
from planning_exercise_path_builder import (
EvaluateStepPayload,
ProgressionPathSuggestRequest,
_assignment_preservation_active,
)
def test_assignment_preservation_explicit_flag():
body = ProgressionPathSuggestRequest(
query="Kumite Beinarbeit Progression",
preserve_slot_assignments=True,
)
assert _assignment_preservation_active(body)
def test_assignment_preservation_not_auto_from_slot_assignments():
"""Nur explizites preserve_slot_assignments — sonst wäre compare/match blockiert."""
body = ProgressionPathSuggestRequest(
query="Kumite Beinarbeit Progression",
slot_assignments=[
EvaluateStepPayload(exercise_id=10, roadmap_major_step_index=0),
EvaluateStepPayload(exercise_id=11, roadmap_major_step_index=1),
],
)
assert not _assignment_preservation_active(body)
def test_assignment_preservation_inactive_without_assignments():
body = ProgressionPathSuggestRequest(query="Kumite Beinarbeit Progression")
assert not _assignment_preservation_active(body)