feat: synchronize CH1 vehicle control and feedback
This commit is contained in:
@@ -8,6 +8,11 @@ from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from cognitive_agent.application.seat_service import REPOSITORY_ROOT, SeatDemoService
|
||||
from cognitive_agent.infrastructure.can.hardware import (
|
||||
HardwareSafetyError,
|
||||
SeatHardwareSettings,
|
||||
VehicleCanSettings,
|
||||
)
|
||||
|
||||
|
||||
SUITE_PATH = REPOSITORY_ROOT / "tests" / "fixtures" / "seat_frontend_hil_suite.json"
|
||||
@@ -185,6 +190,35 @@ class SeatFrontendInputCoverageTests(unittest.TestCase):
|
||||
self.assertEqual(result["function_configs"], {})
|
||||
self.assertIsNone(result["execution_report"])
|
||||
|
||||
def test_mixed_ch1_driver_and_ch0_passenger_hardware_scope_fails_closed(self) -> None:
|
||||
utterances = (
|
||||
"打开主驾和副驾座椅通风",
|
||||
"seat driver vent low, seat passenger vent low",
|
||||
)
|
||||
for index, utterance in enumerate(utterances):
|
||||
with self.subTest(utterance=utterance):
|
||||
with (
|
||||
patch.object(self.service, "_interpret") as interpret,
|
||||
patch.object(SeatHardwareSettings, "authorize") as seat_auth,
|
||||
patch.object(VehicleCanSettings, "authorize") as vehicle_auth,
|
||||
patch.object(VehicleCanSettings, "bridge") as bridge,
|
||||
):
|
||||
with self.assertRaisesRegex(
|
||||
HardwareSafetyError, "mixed CH1.*CH0"
|
||||
):
|
||||
self.service.process(
|
||||
utterance,
|
||||
provider="local",
|
||||
conversation_id=f"conv-mixed-scope-{index}",
|
||||
execution_mode="hardware",
|
||||
vehicle_id=self.suite["vehicle_id"],
|
||||
)
|
||||
|
||||
interpret.assert_not_called()
|
||||
seat_auth.assert_not_called()
|
||||
vehicle_auth.assert_not_called()
|
||||
bridge.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user