All checks were successful
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 40s
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
Test Suite / pytest-backend (pull_request) Successful in 37s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 13s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m15s
- Incremented version to 0.8.183, reflecting the implementation of Phase C1 enhancements. - Added support for progression graph auto-matching and variant-aware successors in exercise suggestions. - Updated request and response structures to include `anchor_exercise_variant_id`, `progression_graph_name`, and `suggested_variant_id`. - Enhanced frontend components to integrate planning AI search capabilities, including a new modal for exercise creation and improved context display in the exercise list. - Updated changelog to document these significant improvements in planning AI functionality.
57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
"""Tests Progressionsgraph-Auflösung für Planungs-KI (Phase C1)."""
|
|
from planning_exercise_progression import (
|
|
edge_matches_anchor_from,
|
|
filter_outgoing_progression_edges,
|
|
parse_successors_from_edges,
|
|
rank_progression_graph_rows,
|
|
)
|
|
|
|
|
|
def test_edge_matches_anchor_from_generic_edge():
|
|
assert edge_matches_anchor_from({"from_exercise_variant_id": None}, None)
|
|
assert edge_matches_anchor_from({"from_exercise_variant_id": None}, 5)
|
|
|
|
|
|
def test_edge_matches_anchor_from_variant_specific():
|
|
assert edge_matches_anchor_from({"from_exercise_variant_id": 3}, 3)
|
|
assert not edge_matches_anchor_from({"from_exercise_variant_id": 3}, None)
|
|
assert not edge_matches_anchor_from({"from_exercise_variant_id": 3}, 4)
|
|
|
|
|
|
def test_filter_outgoing_progression_edges():
|
|
edges = [
|
|
{"from_exercise_variant_id": None, "to_exercise_id": 10},
|
|
{"from_exercise_variant_id": 2, "to_exercise_id": 11},
|
|
]
|
|
filtered = filter_outgoing_progression_edges(edges, from_variant_id=2)
|
|
assert len(filtered) == 2
|
|
only_generic = filter_outgoing_progression_edges(edges, from_variant_id=None)
|
|
assert len(only_generic) == 1
|
|
assert only_generic[0]["to_exercise_id"] == 10
|
|
|
|
|
|
def test_parse_successors_from_edges():
|
|
ids, notes, variants = parse_successors_from_edges(
|
|
[
|
|
{
|
|
"to_exercise_id": 20,
|
|
"to_exercise_variant_id": 7,
|
|
"notes": " leicht ",
|
|
},
|
|
{"to_exercise_id": 21, "to_exercise_variant_id": None, "notes": ""},
|
|
]
|
|
)
|
|
assert ids == {20, 21}
|
|
assert notes[20] == "leicht"
|
|
assert variants[20] == 7
|
|
assert variants[21] is None
|
|
|
|
|
|
def test_rank_progression_graph_rows_prefers_variant_match():
|
|
rows = [
|
|
{"id": 1, "variant_match_count": 0, "outgoing_count": 5},
|
|
{"id": 2, "variant_match_count": 2, "outgoing_count": 1},
|
|
]
|
|
best = rank_progression_graph_rows(rows)
|
|
assert best["id"] == 2
|