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

This commit is contained in:
2026-02-28 19:24:02 -05:00
parent ee2d6f4234
commit cc806d2cc6
9 changed files with 20 additions and 21 deletions

View File

@@ -1,13 +1,14 @@
import pytest
from unittest.mock import MagicMock, patch
from typing import Generator
import dearpygui.dearpygui as dpg
import gui_legacy
from gui_legacy import App
import ai_client
@pytest.fixture
def app_instance() -> None:
def app_instance() -> Generator[App, None, None]:
"""
Fixture to create an instance of the App class for testing.
It creates a real DPG context but mocks functions that would
@@ -33,8 +34,7 @@ def app_instance() -> None:
yield app
dpg.destroy_context()
def test_gui_updates_on_event(app_instance):
# Patch dependencies for the test
def test_gui_updates_on_event(app_instance: App) -> None:
with patch('dearpygui.dearpygui.set_value') as mock_set_value, \
patch('dearpygui.dearpygui.does_item_exist', return_value=True), \
patch('dearpygui.dearpygui.configure_item'), \