version: sunnypilot v2026.002.000 (staging) date: 2026-07-21T07:44:02 master commit: 2c334ede443d7391d27575af8c854a095ba702a8
20 lines
688 B
Python
20 lines
688 B
Python
import re
|
|
import unittest
|
|
|
|
from opendbc.car.honda.fingerprints import FW_VERSIONS
|
|
from opendbc.car.honda.values import HONDA_BOSCH, HONDA_BOSCH_TJA_CONTROL
|
|
|
|
HONDA_FW_VERSION_RE = br"[A-Z0-9]{5}(-|,)[A-Z0-9]{3}(-|,)[A-Z0-9]{4}(\x00){2}$"
|
|
|
|
|
|
class TestHondaFingerprint(unittest.TestCase):
|
|
def test_fw_version_format(self):
|
|
# Asserts all FW versions follow an expected format
|
|
for fw_by_ecu in FW_VERSIONS.values():
|
|
for fws in fw_by_ecu.values():
|
|
for fw in fws:
|
|
assert re.match(HONDA_FW_VERSION_RE, fw) is not None, fw
|
|
|
|
def test_tja_bosch_only(self):
|
|
assert set(HONDA_BOSCH_TJA_CONTROL).issubset(set(HONDA_BOSCH)), "Nidec car found in TJA control list"
|