From 4284b3a50e8fd3a90826d879e53eb741ea5f2e10 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Fri, 29 Dec 2023 13:47:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20Remove=20obsolete=20rou?= =?UTF-8?q?ter=5Ftest.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/router_test.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 tests/router_test.py diff --git a/tests/router_test.py b/tests/router_test.py deleted file mode 100644 index f230bce..0000000 --- a/tests/router_test.py +++ /dev/null @@ -1,43 +0,0 @@ -from funcchain.components import ChatRouter - - -def handle_pdf_requests(user_query: str) -> str: - return f"Handling PDF requests with user query: {user_query}" - - -def handle_csv_requests(user_query: str) -> str: - return f"Handling CSV requests with user query: {user_query}" - - -router = ChatRouter[str]( - routes={ - "pdf": { - "handler": handle_pdf_requests, - "description": "Call this for requests including PDF Files.", - }, - "csv": { - "handler": handle_csv_requests, - "description": "Call this for requests including CSV Files.", - }, - "default": { - "handler": lambda x: f"Handling DEFAULT with user query: {x}", - "description": "Call this for all other requests.", - }, - }, -) - - -def test_router() -> None: - assert "Handling CSV" in router.invoke_route("Can you summarize this csv?") - - assert "Handling PDF" in router.invoke_route("Can you summarize this pdf?") - - assert "Handling DEFAULT" in router.invoke_route("whatsup") - - assert "Handling DEFAULT" in router.invoke_route( - "I want to book a flight how to do this?" - ) - - -if __name__ == "__main__": - test_router()