Files
StarPilot/openpilot/starpilot/lateral/tests/test_lane_change_defaults.py
T
firestar5683 79c8945a41 Lateral
Integrate torque feedback, lane-change smoothing and low-speed Turn Assist through dedicated lateral owners.

Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>

Co-authored-by: pharmacomaniac <blittle65@gmail.com>
2026-10-14 20:02:39 -05:00

23 lines
704 B
Python

import json
from openpilot.starpilot.lateral.lane_change_preferences import LaneChangePolicy, decode, to_value, read_saved
def test_unset_defaults_on_without_writing(tmp_path):
class Source:
def get_param_path(self, key):
return str(tmp_path / key)
source = Source()
for _ in range(3):
assert read_saved(source).policy.one_per_signal
assert not list(tmp_path.iterdir())
def test_explicit_off_survives_document_roundtrip():
policy = LaneChangePolicy(one_per_signal=False)
raw = json.dumps(to_value(policy)).encode()
for _ in range(3):
saved = decode(raw)
assert saved is not None and not saved.one_per_signal
assert json.dumps(to_value(saved)).encode() == raw