mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-12 04:42:13 +08:00
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from types import SimpleNamespace
|
|
|
|
from openpilot.starpilot.common import starpilot_variables as spv
|
|
|
|
|
|
def test_legacy_volt_stock_acc_models_share_sng_and_auto_hold_scope():
|
|
assert spv.LEGACY_VOLT_STOCK_ACC_CARS == {
|
|
"CHEVROLET_VOLT",
|
|
"CHEVROLET_VOLT_2019",
|
|
"CHEVROLET_VOLT_ASCM",
|
|
"CHEVROLET_VOLT_CAMERA",
|
|
}
|
|
|
|
|
|
def test_get_starpilot_toggles_uses_last_non_empty_broadcast(monkeypatch):
|
|
params = SimpleNamespace(get_bool=lambda _key: False)
|
|
monkeypatch.setattr(spv.get_starpilot_toggles, "_params", params, raising=False)
|
|
monkeypatch.delattr(spv.get_starpilot_toggles, "_last_toggles_text", raising=False)
|
|
|
|
payload = '{"always_on_lateral": true, "vision_speed_limit_detection": true}'
|
|
sm_with_toggles = {"starpilotPlan": SimpleNamespace(starpilotToggles=payload)}
|
|
sm_without_toggles = {"starpilotPlan": SimpleNamespace(starpilotToggles="")}
|
|
|
|
first = spv.get_starpilot_toggles(sm_with_toggles)
|
|
second = spv.get_starpilot_toggles(sm_without_toggles)
|
|
|
|
assert first.always_on_lateral is True
|
|
assert second.always_on_lateral is True
|
|
assert second.vision_speed_limit_detection is True
|