shinkan-jinkendo/backend/tests/test_planning_exercise_text_signals.py
Lars a0a891e550
Some checks failed
Test Suite / playwright-tests (push) Waiting to run
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 41s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Has been cancelled
Implement Phase B Enhancements for Planning Exercise Profiles
- Added support for section guidance notes and titles in the planning target profile, enabling richer context for exercise suggestions.
- Introduced deterministic text-to-catalog signal mapping, allowing for improved integration of planning text signals into the exercise retrieval process.
- Implemented a partner-related filter in exercise retrieval, enhancing the relevance of suggested exercises based on user intent.
- Updated the retrieval phase to account for text signals, improving the accuracy of exercise recommendations.
- Incremented version to 0.8.181 and updated changelog to reflect these significant enhancements in planning AI capabilities.
2026-05-23 10:26:03 +02:00

48 lines
1.5 KiB
Python

"""Tests Phase B: Text-Signale für PlanningTargetProfile."""
from planning_exercise_text_signals import resolve_planning_text_to_catalog_weights
def test_resolve_planning_text_matches_skill_and_partner_hint():
class _Cur:
def execute(self, sql, params=None):
self._sql = sql
def fetchall(self):
sql = getattr(self, "_sql", "")
if "FROM skills" in sql:
return [
{"id": 5, "name": "Kime"},
{"id": 8, "name": "Schnellkraft"},
{"id": 2, "name": "Ab"},
]
if "FROM focus_areas" in sql:
return [{"id": 10, "name": "Karate Technik"}]
if "FROM style_directions" in sql:
return []
if "FROM training_types" in sql:
return []
if "FROM target_groups" in sql:
return [{"id": 3, "name": "Partnerübung"}]
return []
focus, style, tt, tg, skills = resolve_planning_text_to_catalog_weights(
_Cur(),
"Abschnitt: Kime vertiefen mit Partnerübung",
)
assert skills.get(5, 0) > 0
assert 8 not in skills
assert tg.get(3, 0) > 0
assert not style and not tt
def test_resolve_planning_text_empty():
class _Cur:
def execute(self, sql, params=None):
pass
def fetchall(self):
return []
focus, style, tt, tg, skills = resolve_planning_text_to_catalog_weights(_Cur(), " ")
assert not focus and not skills