Refactor radar system
This commit is contained in:
@@ -11,7 +11,6 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -19,6 +18,7 @@ os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
||||
from PyQt6.QtWidgets import QApplication # noqa: E402
|
||||
|
||||
from python_app.gui.app_window import AppWindow # noqa: E402
|
||||
from python_app.tests.gui_test_support import isolated_window
|
||||
from python_app.models.dataset_model import ( # noqa: E402
|
||||
ComboKey,
|
||||
ResultBlock,
|
||||
@@ -33,7 +33,7 @@ _window: AppWindow | None = None
|
||||
def setUpModule() -> None:
|
||||
global _app, _window
|
||||
_app = QApplication.instance() or QApplication([])
|
||||
_window = AppWindow(Path("."))
|
||||
_window = isolated_window(unittest.addModuleCleanup)
|
||||
|
||||
|
||||
def tearDownModule() -> None:
|
||||
@@ -89,6 +89,15 @@ class SingleCaptureBoundaryTest(unittest.TestCase):
|
||||
self.assertTrue(self.w._finish_single_capture_if_ready())
|
||||
self.assertFalse(self.w._single_capture_active) # _stop_run cleared the flag
|
||||
|
||||
def test_empty_processed_trace_completes_capture_instead_of_waiting_for_timeout(self) -> None:
|
||||
result = _result(5, 1500)
|
||||
payload = result.blocks[0].payloads[0]
|
||||
payload.frequency_hz = np.empty(0, dtype=np.float32)
|
||||
payload.trace = np.empty(0, dtype=np.complex64)
|
||||
self.w._result_history.append(result)
|
||||
self.assertTrue(self.w._finish_single_capture_if_ready())
|
||||
self.assertFalse(self.w._single_capture_active)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user