From ccb71bf43fb511eed4bde5d594a032075cc48734 Mon Sep 17 00:00:00 2001 From: Dawn Date: Tue, 8 Sep 2026 14:56:55 +0200 Subject: [PATCH] test: format the mocked token and cast the tell-state stand-in for basedpyright Co-Authored-By: Claude Fable 5.1 --- tests/unit/gui/test_busy_overlay.py | 8 ++++++-- tests/unit/gui/test_main_window.py | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/unit/gui/test_busy_overlay.py b/tests/unit/gui/test_busy_overlay.py index e37f8234..b7043113 100644 --- a/tests/unit/gui/test_busy_overlay.py +++ b/tests/unit/gui/test_busy_overlay.py @@ -54,12 +54,16 @@ def test_auto_centering_flag_overrides_alignment_gate(): def test_robot_cooling_is_the_only_blue_busy_state(): from types import SimpleNamespace + from typing import cast + + from aarecommon.models.tell import TellStateModel from aare.gui.styles import BUSY_BLUE, BUSY_PSI_RED def _style(activity: str): - tell = SimpleNamespace(activity=SimpleNamespace(value=activity)) - style = build_busy_overlay_style(is_busy=True, tell_state=tell) # type: ignore[arg-type] + # Only .activity.value is read; cast keeps basedpyright off the stand-in. + tell = cast(TellStateModel, SimpleNamespace(activity=SimpleNamespace(value=activity))) + style = build_busy_overlay_style(is_busy=True, tell_state=tell) assert style is not None return style diff --git a/tests/unit/gui/test_main_window.py b/tests/unit/gui/test_main_window.py index 5c07d5c0..e709e3ea 100644 --- a/tests/unit/gui/test_main_window.py +++ b/tests/unit/gui/test_main_window.py @@ -619,7 +619,12 @@ def test_sample_camera_frame_paints_visible_views_and_acks(qtbot, mock_ui_state, patch("aare.gui.main_window.JFJochDBusClient"), patch("aare.gui.main_window.jwt.decode") as mock_jwt, ): - mock_jwt.return_value = {"sub": "testuser", "staff": True, "pgroups": ["p123"], "session": 15} + mock_jwt.return_value = { + "sub": "testuser", + "staff": True, + "pgroups": ["p123"], + "session": 15, + } win = _make_window(qtbot) views = (win.sample_camera, win.compact_sample_camera, win.portrait_sample_camera)