From d1c0ae70e2955b0ca2feb2e62aebb4f98fe74912 Mon Sep 17 00:00:00 2001 From: Yevhenii Vaskivskyi Date: Sat, 14 Sep 2024 09:38:33 +0200 Subject: [PATCH] Remove log warning for known cases of wrong FW strings (#539) --- asusrouter/modules/firmware.py | 6 +++++- tests/modules/test_firmware.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/asusrouter/modules/firmware.py b/asusrouter/modules/firmware.py index a18c6aa..2e96265 100644 --- a/asusrouter/modules/firmware.py +++ b/asusrouter/modules/firmware.py @@ -140,7 +140,11 @@ def from_string(self, fw_string: Optional[str] = None) -> None: fw_string = clean_string(fw_string) if not fw_string: - return + return None + + # Special cases for old firmwares and absent data + if fw_string == "__": + return None pattern = ( r"^(?P[39].?0.?0.?[46])?[_.]?" diff --git a/tests/modules/test_firmware.py b/tests/modules/test_firmware.py index b9d9ecb..06d93b2 100644 --- a/tests/modules/test_firmware.py +++ b/tests/modules/test_firmware.py @@ -161,6 +161,7 @@ def test_update_source(self, revision, expected_source): ), # Additional cases (".386.7_120", None, 386, 7, 120, False, False), + ("__", None, None, None, None, False, False), # Invalid input ("", None, None, None, None, False, False), ("invalid", None, None, None, None, False, False),