refactor(tests): Add strict type hints to fourth batch of test files

This commit is contained in:
2026-02-28 19:20:41 -05:00
parent e8513d563b
commit ee2d6f4234
9 changed files with 34 additions and 27 deletions

View File

@@ -1,3 +1,4 @@
from typing import Generator
import pytest
from unittest.mock import MagicMock, patch, AsyncMock
import asyncio
@@ -7,7 +8,7 @@ from events import UserRequestEvent
import ai_client
@pytest.fixture
def mock_app() -> None:
def mock_app() -> Generator[App, None, None]:
with (
patch('gui_2.load_config', return_value={
"ai": {"provider": "gemini", "model": "model-1", "temperature": 0.0, "max_tokens": 100, "history_trunc_limit": 1000},
@@ -33,7 +34,7 @@ def mock_app() -> None:
# so we just let it daemon-exit.
@pytest.mark.timeout(10)
def test_user_request_integration_flow(mock_app):
def test_user_request_integration_flow(mock_app: App) -> None:
"""
Verifies that pushing a UserRequestEvent to the event_queue:
1. Triggers ai_client.send
@@ -83,7 +84,7 @@ def test_user_request_integration_flow(mock_app):
assert app.ai_status == "done"
@pytest.mark.timeout(10)
def test_user_request_error_handling(mock_app):
def test_user_request_error_handling(mock_app: App) -> None:
"""
Verifies that if ai_client.send raises an exception, the UI is updated with the error state.
"""