From d313027666cbb6deda0c9fbb6de2d39515851e05 Mon Sep 17 00:00:00 2001 From: Siraj R Aizlewood <siraj@aurelio.ai> Date: Tue, 30 Apr 2024 04:37:22 +0400 Subject: [PATCH] New pytest. --- tests/unit/llms/test_llm_openai.py | 14 +++++++++++++- tests/unit/test_route.py | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/unit/llms/test_llm_openai.py b/tests/unit/llms/test_llm_openai.py index 9f1b9427..25573bd9 100644 --- a/tests/unit/llms/test_llm_openai.py +++ b/tests/unit/llms/test_llm_openai.py @@ -2,7 +2,7 @@ import pytest from semantic_router.llms import OpenAILLM from semantic_router.schema import Message -from semantic_router.utils.function_call import get_schema_openai +from semantic_router.utils.function_call import get_schema_openai, convert_param_type_to_json_type @pytest.fixture @@ -167,3 +167,15 @@ class TestOpenAILLM: assert ( expected_error_message in actual_error_message ), f"Expected error message: '{expected_error_message}', but got: '{actual_error_message}'" + + + def test_convert_param_type_to_json_type(self): + # Test conversion of basic types + assert convert_param_type_to_json_type("int") == "number" + assert convert_param_type_to_json_type("float") == "number" + assert convert_param_type_to_json_type("str") == "string" + assert convert_param_type_to_json_type("bool") == "boolean" + assert convert_param_type_to_json_type("NoneType") == "null" + assert convert_param_type_to_json_type("list") == "array" + # Test conversion of a type not explicitly handled + assert convert_param_type_to_json_type("dict") == "object" \ No newline at end of file diff --git a/tests/unit/test_route.py b/tests/unit/test_route.py index 3cedeadb..5b91f9d3 100644 --- a/tests/unit/test_route.py +++ b/tests/unit/test_route.py @@ -5,7 +5,6 @@ import pytest from semantic_router.llms import BaseLLM from semantic_router.route import Route, is_valid - # Is valid test: def test_is_valid_with_valid_json(): valid_json = '{"name": "test_route", "utterances": ["hello", "hi"]}' -- GitLab