from __future__ import annotations import pytest from cmvr_edge_ai.connectors.cmvr_es import CmvrAgvCommandSink VELOCITY_LIMITS = { "vx": {"min": -0.5, "max": 0.5}, "vy": {"min": -0.3, "max": 0.3}, "wz": {"min": -1.0, "max": 1.0}, } def test_agv_sink_requires_a_fixed_device() -> None: with pytest.raises(ValueError, match="fixed, non-empty device_id"): CmvrAgvCommandSink("agv", {"endpoint": "cmvr_es"}) def test_unsafe_velocity_override_requires_a_real_boolean() -> None: with pytest.raises(ValueError, match="must be a boolean"): CmvrAgvCommandSink( "agv", { "endpoint": "cmvr_es", "device_id": "src1100", # Environment expansion deliberately leaves plugin params as # strings. The dangerous override must not use bool("false"). "unsafe_allow_unleased_velocity": "false", "velocity_limits": VELOCITY_LIMITS, }, ) def test_unsafe_velocity_override_requires_sink_side_limits() -> None: with pytest.raises(ValueError, match="requires explicit velocity_limits"): CmvrAgvCommandSink( "agv", { "endpoint": "cmvr_es", "device_id": "src1100", "unsafe_allow_unleased_velocity": True, }, )