added ruff test

This commit is contained in:
ykcheungab
2026-09-27 19:20:43 +08:00
parent bcab2790bf
commit fa2703968e
178 changed files with 3277 additions and 1034 deletions
+13 -7
View File
@@ -20,6 +20,7 @@ mathematics (the camera, the sampler and the composer have their own files):
from __future__ import annotations
import math
import time
from concurrent.futures import Future
from dataclasses import replace
@@ -27,17 +28,14 @@ from pathlib import Path
import numpy as np
import pytest
import ui_check
from PySide6.QtCore import Signal
from PySide6.QtWidgets import QWidget
from orisys_app_shared.i18n import t
from orisys_app_shared.scene3d import synthetic
from orisys_app_shared.scene3d.contracts import (
UNAVAILABLE_DESCRIPTOR,
ColorScale,
DisplaySettings,
FieldDescriptor,
UNAVAILABLE_DESCRIPTOR,
)
from orisys_app_shared.scene3d.package import write_package
from orisys_studio.app_window import MIN_PANEL_WIDTHS
@@ -49,9 +47,15 @@ from orisys_studio.scene3d.asset_source import (
load_package,
no_asset_diagnostic,
)
from PySide6.QtCore import Signal
from PySide6.QtWidgets import QWidget
from tests.conftest import (
finish_run as _finish,
)
from tests.conftest import (
running_window as _running_window,
)
from tests.conftest import (
show_window as _show,
)
@@ -60,7 +64,7 @@ from tests.conftest import (
def write_poc(tmp_path):
"""A real package on disk, produced by the shipping writer."""
def _write(name: str = "finger-display-1.0.0") -> "object":
def _write(name: str = "finger-display-1.0.0") -> object:
path = tmp_path / f"{name}{PACKAGE_SUFFIX}"
write_package(
synthetic.poc_scene(),
@@ -520,7 +524,9 @@ def test_a_hand_edited_settings_block_is_repaired(block):
assert settings.field in scene3d_prefs.FIELD_CHOICES
if settings.color_scale is not None:
lower, upper = settings.color_scale.lower, settings.color_scale.upper
assert lower == lower and upper == upper, "a NaN survived the repair"
# Not a tautology: ``float("nan")`` is in the parametrisation above, and this
# is the assertion that the repair actually replaced it.
assert not math.isnan(lower) and not math.isnan(upper), "a NaN survived the repair"
assert upper > lower
assert abs(lower) <= scene3d_prefs.MAX_SCALE_BOUND
assert abs(upper) <= scene3d_prefs.MAX_SCALE_BOUND
@@ -1129,8 +1135,8 @@ def test_every_run_gets_a_new_generation(make_window, qt_app):
Without this the pane accepts the first run's frames and refuses every later run's,
so the picture stays on the first run's last frame forever.
"""
from orisys_app_shared.scene3d.contracts import FrameIdentity
import ui_check
from orisys_app_shared.scene3d.contracts import FrameIdentity
window = _show(make_window(sensor_type="finger"), (1440, 880))
try: