mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-21 08:31:13 +00:00
bf5b0e3ae2
- Move pytestmark after all imports in 35 test files (E402: not-at-top) - Add TYPE_CHECKING guard for FlightProcessor in composition.py (F821) - Sort import blocks in src/ and tests/ (I001 auto-fix via ruff --fix) - ruff check src/ tests/ now exits 0 with no errors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
1.5 KiB
Python
66 lines
1.5 KiB
Python
"""Tests for DatasetAdapter base contract."""
|
|
|
|
import pytest
|
|
|
|
from gps_denied.testing.datasets.base import (
|
|
DatasetAdapter,
|
|
DatasetCapabilities,
|
|
DatasetFrame,
|
|
DatasetIMU,
|
|
DatasetNotAvailableError,
|
|
DatasetPose,
|
|
PlatformClass,
|
|
)
|
|
|
|
pytestmark = [pytest.mark.unit]
|
|
|
|
|
|
def test_capabilities_defaults():
|
|
cap = DatasetCapabilities(
|
|
has_raw_imu=False,
|
|
has_rtk_gt=False,
|
|
has_loop_closures=False,
|
|
platform_class=PlatformClass.FIXED_WING,
|
|
)
|
|
assert cap.has_raw_imu is False
|
|
assert cap.platform_class == PlatformClass.FIXED_WING
|
|
|
|
|
|
def test_adapter_is_abstract():
|
|
with pytest.raises(TypeError):
|
|
DatasetAdapter() # type: ignore[abstract]
|
|
|
|
|
|
def test_dataset_not_available_error_is_exception():
|
|
assert issubclass(DatasetNotAvailableError, Exception)
|
|
|
|
|
|
def test_dataset_frame_dataclass_fields():
|
|
frame = DatasetFrame(
|
|
frame_idx=0,
|
|
timestamp_ns=1_000_000_000,
|
|
image_path="/tmp/x.jpg",
|
|
)
|
|
assert frame.frame_idx == 0
|
|
assert frame.timestamp_ns == 1_000_000_000
|
|
|
|
|
|
def test_dataset_imu_dataclass_fields():
|
|
imu = DatasetIMU(
|
|
timestamp_ns=1_000_000_000,
|
|
accel=(0.0, 0.0, -9.81),
|
|
gyro=(0.0, 0.0, 0.0),
|
|
)
|
|
assert imu.accel == (0.0, 0.0, -9.81)
|
|
|
|
|
|
def test_dataset_pose_dataclass_fields():
|
|
pose = DatasetPose(
|
|
timestamp_ns=1_000_000_000,
|
|
lat=49.0,
|
|
lon=32.0,
|
|
alt=100.0,
|
|
qx=0.0, qy=0.0, qz=0.0, qw=1.0,
|
|
)
|
|
assert pose.lat == 49.0
|