23 lines
1.3 KiB
Python
23 lines
1.3 KiB
Python
"""Catalog routes that keep a question's topic and exclusion (19. 11. 2026 suite)."""
|
|
from tools.answers.planning.question_catalog import CatalogDecision, _topic_in_question, route_for
|
|
|
|
|
|
def decision(**fields):
|
|
base = dict(type="students_of_advisor", people=["Daniela Hládka"], topic=None, topic_canonical=None, exclude=None,
|
|
action="any", facets=[], presentation="default", meeting="none", work_types=[])
|
|
return CatalogDecision(**{**base, **fields})
|
|
|
|
|
|
def test_students_of_a_supervisor_who_did_a_topic_search_the_topic_with_the_exclusion():
|
|
question = "Ktorí študenti Daniela Hládka od roku 2024 robili s LLM, bez RASA?"
|
|
resolution = {"matches": [{"name": "Daniel Hladek", "input": "Daniela Hládka"}], "resolved_query": question}
|
|
route = route_for(decision(topic="LLM", exclude="RASA"), resolution)
|
|
assert route.type == "who_did_topic" and route.topic == "LLM" and route.exclusion == "RASA"
|
|
|
|
|
|
def test_a_plain_roster_keeps_its_type_even_with_a_guessed_topic():
|
|
question = "Kto sú študenti Daniela Hládka?"
|
|
resolution = {"matches": [{"name": "Daniel Hladek", "input": "Daniela Hládka"}], "resolved_query": question}
|
|
assert route_for(decision(topic="študenti"), resolution).type == "students_of_advisor"
|
|
assert not _topic_in_question("RAG", question)
|