Download tests/test_retrieval.py from Estarcode/campusdesk-ai: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/Estarcode/campusdesk-ai/resolve/main/tests/test_retrieval.py
- Command line
-
hf download hf://Estarcode/campusdesk-ai/tests/test_retrieval.py
-
curl -L -o test_retrieval.py https://huggingface.co/Estarcode/campusdesk-ai/resolve/main/tests/test_retrieval.py
1.25 kB
| """Tests for hybrid multilingual + BM25 retrieval and top-3 cross-notice coverage.""" | |
| from src.pipeline.query_planner import plan_query | |
| from src.retrieval.retriever import get_retriever | |
| def test_worked_acceptance_multipart_retrieves_both_notices_in_top3(): | |
| retriever = get_retriever() | |
| qplan = plan_query("I fit still apply on 12 June 2026? Which paper I need carry?") | |
| top3 = retriever.retrieve(qplan.subqueries, predicted_intent="deadlines", top_k=3) | |
| ids = {rp.passage.passage_id for rp in top3} | |
| assert len(top3) == 3 | |
| assert "N02-P01" in ids, f"Expected N02-P01 amendment in top3, got {ids}" | |
| assert "N01-P02" in ids, f"Expected N01-P02 documents in top3, got {ids}" | |
| def test_cross_format_pdf_and_csv_retrieval_in_top3(): | |
| retriever = get_retriever() | |
| qplan = plan_query( | |
| "If I lost my ZIT Student ID card before applying, what must I do and pay, and what other mandatory documents are needed?" | |
| ) | |
| top3 = retriever.retrieve(qplan.subqueries, predicted_intent="required_documents", top_k=3) | |
| ids = {rp.passage.passage_id for rp in top3} | |
| assert "N09-R03" in ids, f"Expected CSV fee row N09-R03 in top3, got {ids}" | |
| assert "N01-P02" in ids, f"Expected PDF N01-P02 in top3, got {ids}" | |