From 44c8d8ed84e9c34196b5d6eff498f350f3466cf8 Mon Sep 17 00:00:00 2001 From: Vitali Graf Date: Sun, 12 Apr 2026 12:29:34 +0200 Subject: [PATCH] fix: TkProgressTqdm Typ-Signatur und Test-Isolation verbessert --- tests/test_download_progress.py | 3 +++ whisper_local/tray/_download_progress.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_download_progress.py b/tests/test_download_progress.py index 511cbc5..ecc0494 100644 --- a/tests/test_download_progress.py +++ b/tests/test_download_progress.py @@ -7,6 +7,9 @@ from whisper_local.tray._download_progress import TkProgressTqdm class TestTkProgressTqdm: + def teardown_method(self): + TkProgressTqdm._queue = None + def test_update_puts_message_in_queue(self): q = queue.Queue() TkProgressTqdm._queue = q diff --git a/whisper_local/tray/_download_progress.py b/whisper_local/tray/_download_progress.py index 37b558f..3b6d055 100644 --- a/whisper_local/tray/_download_progress.py +++ b/whisper_local/tray/_download_progress.py @@ -20,7 +20,9 @@ class TkProgressTqdm(tqdm_module.tqdm): self._accumulated_n = 0 super().__init__(*args, **kwargs) - def update(self, n: int = 1) -> bool | None: + def update(self, n: int | float | None = 1) -> bool | None: + if n is None: + n = 0 self._accumulated_n += n result = super().update(n) if self._queue is not None: