import pytest from sqlalchemy import create_engine from sqlalchemy.orm import Session from app.core.database import Base from app.models.department import Department from app.services.routing_service import match_department @pytest.mark.parametrize("include_finance", [False, True]) def test_unmatched_query_without_admin_stays_unassigned(include_finance): engine = create_engine("sqlite+pysqlite:///:memory:") try: Base.metadata.create_all(engine) with Session(engine) as db: if include_finance: db.add(Department( name="Finance", code="FIN", keywords="tuition, fee, refund", query="Sir i want refund my fee", )) db.commit() result = match_department( db, "I have updated the syllabus. Please review the course outline.", ) assert result == (None, 0) finally: engine.dispose()