Some checks failed
CI / lint (pull_request) Has been cancelled
CI / type (pull_request) Has been cancelled
CI / test-headless (macos-latest, 3.10) (pull_request) Has been cancelled
CI / test-headless (macos-latest, 3.11) (pull_request) Has been cancelled
CI / test-headless (macos-latest, 3.12) (pull_request) Has been cancelled
CI / test-headless (ubuntu-latest, 3.10) (pull_request) Has been cancelled
CI / test-headless (ubuntu-latest, 3.11) (pull_request) Has been cancelled
CI / test-headless (ubuntu-latest, 3.12) (pull_request) Has been cancelled
CI / test-headless (windows-latest, 3.10) (pull_request) Has been cancelled
CI / test-headless (windows-latest, 3.11) (pull_request) Has been cancelled
CI / test-headless (windows-latest, 3.12) (pull_request) Has been cancelled
CI / test-gui (pull_request) Has been cancelled
CI / test-integration (macos-latest) (pull_request) Has been cancelled
CI / test-integration (ubuntu-latest) (pull_request) Has been cancelled
CI / test-integration (windows-latest) (pull_request) Has been cancelled
Auto-fixes (UP037, UP038, F401, I001, SIM105, RUF100) plus hand-fixes: drop the now-unused `Union` imports, annotate mutable class attributes with ClassVar, raise ValidationError instead of blind Exception in the zero-length test, delete two dead locals, and bind the per-iteration grid-builder closures to their loop variables (B023).
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
"""GUI tests for Define dialogs."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
pytest.importorskip("PySide6")
|
|
|
|
from otko.core import LinearTimeSeries, Project
|
|
from otko.views.dialogs.linear_time_series import LinearTimeSeriesDialog
|
|
from otko.views.dialogs.plain_pattern import PlainPatternDialog
|
|
|
|
|
|
@pytest.mark.gui
|
|
def test_linear_time_series_dialog_builds_entity(qtbot) -> None: # type: ignore[no-untyped-def]
|
|
dlg = LinearTimeSeriesDialog(next_ts_id=3)
|
|
qtbot.addWidget(dlg)
|
|
|
|
dlg._name_edit.setText("Gravity")
|
|
dlg._factor_spin.setValue(1.5)
|
|
|
|
ts = dlg.time_series()
|
|
assert ts.id == 3
|
|
assert ts.name == "Gravity"
|
|
assert ts.factor == pytest.approx(1.5)
|
|
|
|
|
|
@pytest.mark.gui
|
|
def test_plain_pattern_dialog_uses_selected_time_series(qtbot) -> None: # type: ignore[no-untyped-def]
|
|
proj = Project(
|
|
time_series=[
|
|
LinearTimeSeries(id=1, name="GravityTS"),
|
|
LinearTimeSeries(id=2, name="RampTS"),
|
|
]
|
|
)
|
|
dlg = PlainPatternDialog(project=proj, next_pattern_id=4)
|
|
qtbot.addWidget(dlg)
|
|
|
|
dlg._name_edit.setText("Gravity")
|
|
dlg._ts_cb.setCurrentIndex(1)
|
|
|
|
pat = dlg.pattern()
|
|
assert pat.id == 4
|
|
assert pat.name == "Gravity"
|
|
assert pat.time_series_id == 2
|