mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-06-21 11:41:13 +00:00
5744ff65ac
- Add pytestmark = [pytest.mark.<category>] to all 23 root test files and 14 e2e test files - Marker distribution: 22 unit, 7 integration, 1 blackbox, 1 sitl, 5 e2e + 2 e2e integration - Add import pytest to test_models.py, test_download.py, test_synthetic_adapter.py (were missing) - Convert test_sitl_integration.py's bare pytestmark to list form preserving skipif guard - Union of all 5 markers = 298/298 = 100% coverage; 216 tests pass with --strict-markers
66 lines
1.5 KiB
Python
66 lines
1.5 KiB
Python
"""Tests for DatasetAdapter base contract."""
|
|
|
|
import pytest
|
|
|
|
pytestmark = [pytest.mark.unit]
|
|
|
|
from gps_denied.testing.datasets.base import (
|
|
DatasetAdapter,
|
|
DatasetCapabilities,
|
|
DatasetFrame,
|
|
DatasetIMU,
|
|
DatasetNotAvailableError,
|
|
DatasetPose,
|
|
PlatformClass,
|
|
)
|
|
|
|
|
|
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
|