@@ -97,7 +97,7 @@ async def test_init_regular_openai(self, mock_openai):
9797 # Set up the mock to return an AsyncMock
9898 mock_openai .return_value = AsyncMock ()
9999
100- client = OpenAIClientWrapper ()
100+ OpenAIClientWrapper ()
101101
102102 # Verify the client was created
103103 assert mock_openai .called
@@ -172,7 +172,7 @@ async def test_create_chat_completion(self, mock_init):
172172
173173
174174@pytest .mark .parametrize (
175- "model_name, expected_provider, expected_max_tokens" ,
175+ ( "model_name" , " expected_provider" , " expected_max_tokens") ,
176176 [
177177 ("gpt-4o" , "openai" , 128000 ),
178178 ("claude-3-sonnet-20240229" , "anthropic" , 200000 ),
@@ -198,15 +198,19 @@ def test_get_model_config(model_name, expected_provider, expected_max_tokens):
198198async def test_model_client_factory ():
199199 """Test the ModelClientFactory"""
200200 # Test with OpenAI model
201- with patch .dict (os .environ , {"OPENAI_API_KEY" : "test-key" }):
202- with patch ("models.OpenAIClientWrapper" ) as mock_openai :
203- mock_openai .return_value = "openai-client"
204- client = await ModelClientFactory .get_client ("gpt-4" )
205- assert client == "openai-client"
201+ with (
202+ patch .dict (os .environ , {"OPENAI_API_KEY" : "test-key" }),
203+ patch ("models.OpenAIClientWrapper" ) as mock_openai ,
204+ ):
205+ mock_openai .return_value = "openai-client"
206+ client = await ModelClientFactory .get_client ("gpt-4" )
207+ assert client == "openai-client"
206208
207209 # Test with Anthropic model
208- with patch .dict (os .environ , {"ANTHROPIC_API_KEY" : "test-key" }):
209- with patch ("models.AnthropicClientWrapper" ) as mock_anthropic :
210- mock_anthropic .return_value = "anthropic-client"
211- client = await ModelClientFactory .get_client ("claude-3-sonnet-20240229" )
212- assert client == "anthropic-client"
210+ with (
211+ patch .dict (os .environ , {"ANTHROPIC_API_KEY" : "test-key" }),
212+ patch ("models.AnthropicClientWrapper" ) as mock_anthropic ,
213+ ):
214+ mock_anthropic .return_value = "anthropic-client"
215+ client = await ModelClientFactory .get_client ("claude-3-sonnet-20240229" )
216+ assert client == "anthropic-client"
0 commit comments