Skip to content

Commit d24d196

Browse files
committed
Update breaking test.
1 parent 9d3efc2 commit d24d196

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

tests/test_core/test_model.py

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,48 +48,31 @@ def __init__(self):
4848
)
4949

5050

51-
def test_init(mock_config):
52-
"""Test the __init__ function."""
53-
handler = ModelHandler(mock_config)
54-
assert handler.tokens_max == mock_config.llm.tokens_max
55-
assert isinstance(handler.cache, dict)
56-
57-
5851
@pytest.mark.asyncio
5952
async def test_batch_request(mock_config, mock_dependencies, mock_summaries):
6053
handler = ModelHandler(mock_config)
61-
handler._process_prompt = AsyncMock(
62-
side_effect=lambda p: f"Processed: {p}"
63-
)
54+
handler._process_prompt = AsyncMock(side_effect=lambda p: f"Processed: {p}")
6455
responses = await handler.batch_request(
6556
[Mock(), Mock()], mock_dependencies, mock_summaries
6657
)
6758
assert "Processed" in responses[0]
6859

6960

7061
@pytest.mark.asyncio
71-
async def test_set_prompt_context(
72-
mock_config, mock_dependencies, mock_summaries
73-
):
62+
async def test_set_prompt_context(mock_config, mock_dependencies, mock_summaries):
7463
"""Test the generate_prompts function."""
7564
file_context = [Mock(), Mock(), Mock()]
7665
handler = ModelHandler(mock_config)
7766
handler.http_client.post = AsyncMock(
7867
side_effect=[
7968
MockResponse(
80-
json_data={
81-
"choices": [{"message": {"content": "Expected summary"}}]
82-
}
69+
json_data={"choices": [{"message": {"content": "Expected summary"}}]}
8370
),
8471
MockResponse(
85-
json_data={
86-
"choices": [{"message": {"content": "Expected summary"}}]
87-
}
72+
json_data={"choices": [{"message": {"content": "Expected summary"}}]}
8873
),
8974
MockResponse(
90-
json_data={
91-
"choices": [{"message": {"content": "Expected summary"}}]
92-
}
75+
json_data={"choices": [{"message": {"content": "Expected summary"}}]}
9376
),
9477
],
9578
)
@@ -108,9 +91,7 @@ async def test_set_prompt_context(
10891
async def test_process_prompt_summaries(mock_config):
10992
"""Test the _process_prompt function."""
11093
handler = ModelHandler(mock_config)
111-
handler._handle_code_summary_response = AsyncMock(
112-
return_value="Processed summary"
113-
)
94+
handler._handle_code_summary_response = AsyncMock(return_value="Processed summary")
11495
mock_prompt = {"type": "summaries", "context": "Some context"}
11596
result = await handler._process_prompt(mock_prompt)
11697
assert result == "Processed summary"
@@ -161,9 +142,7 @@ async def test_handle_response_client_connection_error(mock_config):
161142
with patch("aiohttp.ClientSession.post") as mock_post:
162143
mock_post.side_effect = aiohttp.ClientConnectionError()
163144
handler = ModelHandler(mock_config)
164-
index, response = await handler._handle_response(
165-
"overview", "test prompt", 50
166-
)
145+
index, response = await handler._handle_response("overview", "test prompt", 50)
167146
await handler.close()
168147
assert "aiohttp.client_exceptions.ClientConnectionError" in response
169148

@@ -173,9 +152,7 @@ async def test_handle_response_server_timeout_error(mock_config):
173152
with patch("aiohttp.ClientSession.post") as mock_post:
174153
mock_post.side_effect = aiohttp.ServerTimeoutError()
175154
handler = ModelHandler(mock_config)
176-
index, response = await handler._handle_response(
177-
"overview", "test prompt", 50
178-
)
155+
index, response = await handler._handle_response("overview", "test prompt", 50)
179156
await handler.close()
180157
assert "aiohttp.client_exceptions.ServerTimeoutError" in response
181158

0 commit comments

Comments
 (0)