diff --git a/selfdrive/car/hyundai/tests/test_hyundai.py b/selfdrive/car/hyundai/tests/test_hyundai.py index 08e0fea7a4..b471213183 100755 --- a/selfdrive/car/hyundai/tests/test_hyundai.py +++ b/selfdrive/car/hyundai/tests/test_hyundai.py @@ -34,16 +34,23 @@ class TestHyundaiFingerprint(unittest.TestCase): raise unittest.SkipTest self.assertIn(fuzzy_ecu, [e[0] for e in ecus]) - def test_consistent_fw_dates(self): + def test_fuzzy_fw_dates(self): # Some newer CAN FD platforms have date codes in a different format we don't yet parse, # for now assert date format is consistent across each platform for car_model, ecus in FW_VERSIONS.items(): with self.subTest(car_model=car_model): for ecu, fws in ecus.items(): if ecu[0] in FW_QUERY_CONFIG.fuzzy_ecus: - # TODO: use FW_QUERY_CONFIG.fuzzy_get_platform_codes - has_date = {PLATFORM_CODE_PATTERN.search(fw).groups()[1] is None for fw in fws} - self.assertEqual(len(has_date), 1) + dates = set() + for fw in fws: + # TODO: use FW_QUERY_CONFIG.fuzzy_get_platform_codes + _, date = PLATFORM_CODE_PATTERN.search(fw).groups() + dates.add(date) + if date is None: + continue + parsed = datetime.strptime(date.decode(), '%y%m%d') + self.assertTrue(2013 < parsed.year < 2023, parsed) + self.assertEqual(len({d is None for d in dates}), 1) def test_fuzzy_platform_codes(self): return