From 9aedd4e7949b913845089b2cb44f57377dcf4464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateo=20C=C3=A1mara?= Date: Tue, 9 Jan 2024 13:02:12 +0100 Subject: [PATCH] Moved test to a new file --- litellm/tests/test_acompletion.py | 23 +++++++++++++++++++++++ litellm/tests/test_completion.py | 24 +----------------------- 2 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 litellm/tests/test_acompletion.py diff --git a/litellm/tests/test_acompletion.py b/litellm/tests/test_acompletion.py new file mode 100644 index 00000000000..e5c09b9b78f --- /dev/null +++ b/litellm/tests/test_acompletion.py @@ -0,0 +1,23 @@ +import pytest +from litellm import acompletion + + +def test_acompletion_params(): + import inspect + from litellm.types.completion import CompletionRequest + + acompletion_params_odict = inspect.signature(acompletion).parameters + acompletion_params = {name: param.annotation for name, param in acompletion_params_odict.items()} + completion_params = {field_name: field_type for field_name, field_type in CompletionRequest.__annotations__.items()} + + # remove kwargs + acompletion_params.pop("kwargs", None) + + keys_acompletion = set(acompletion_params.keys()) + keys_completion = set(completion_params.keys()) + + # Assert that the parameters are the same + if keys_acompletion != keys_completion: + pytest.fail("The parameters of the acompletion function and the CompletionRequest class are not the same.") + +# test_acompletion_params() diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 6617f053028..80a51c480b5 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -10,7 +10,7 @@ sys.path.insert( ) # Adds the parent directory to the system path import pytest import litellm -from litellm import embedding, completion, completion_cost, Timeout, acompletion +from litellm import embedding, completion, completion_cost, Timeout from litellm import RateLimitError # litellm.num_retries = 3 @@ -859,28 +859,6 @@ def test_completion_azure_key_completion_arg(): # test_completion_azure_key_completion_arg() -def test_acompletion_params(): - import inspect - from litellm.types.completion import CompletionRequest - - acompletion_params_odict = inspect.signature(acompletion).parameters - acompletion_params = {name: param.annotation for name, param in acompletion_params_odict.items()} - completion_params = {field_name: field_type for field_name, field_type in CompletionRequest.__annotations__.items()} - - # remove kwargs - acompletion_params.pop("kwargs", None) - - keys_acompletion = set(acompletion_params.keys()) - keys_completion = set(completion_params.keys()) - - # Assert that the parameters are the same - if keys_acompletion != keys_completion: - pytest.fail("The parameters of the acompletion function and the CompletionRequest class are not the same.") - - -# test_acompletion_params() - - async def test_re_use_azure_async_client(): try: print("azure gpt-3.5 ASYNC with clie nttest\n\n")