From fa6a00be4921bf40ea88ae2b2c798334f5141acd Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 7 Jun 2023 17:41:44 -0700 Subject: [PATCH] comment --- selfdrive/car/hyundai/tests/test_hyundai.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/hyundai/tests/test_hyundai.py b/selfdrive/car/hyundai/tests/test_hyundai.py index b471213183..3a9a37cef8 100755 --- a/selfdrive/car/hyundai/tests/test_hyundai.py +++ b/selfdrive/car/hyundai/tests/test_hyundai.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from datetime import datetime from collections import defaultdict import unittest @@ -46,10 +47,12 @@ class TestHyundaiFingerprint(unittest.TestCase): # 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) + if date is not None: + # Assert date is parsable and reasonable + parsed = datetime.strptime(date.decode(), '%y%m%d') + self.assertTrue(2013 < parsed.year < 2023, parsed) + + # Either no dates should exist or all dates should be parsed self.assertEqual(len({d is None for d in dates}), 1) def test_fuzzy_platform_codes(self):