From 3ce4abeb1ee9b060ecf4a9e675c2ed8a86524b44 Mon Sep 17 00:00:00 2001 From: vimalnakum Date: Thu, 20 Feb 2025 13:36:27 -0800 Subject: [PATCH 1/2] include 4th response for SR,A,Auto in the check --- compliance/check.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compliance/check.py b/compliance/check.py index a34a45c..fc24f9c 100755 --- a/compliance/check.py +++ b/compliance/check.py @@ -262,12 +262,13 @@ def get_command_by_value_and_number(cmd: str, number: int) -> Optional[str]: initial_amps = get_initial_range(1, msgs[2]["reply"]) initial_volts = get_initial_range(3, msgs[2]["reply"]) - initial_amps_command = get_command_by_value_and_number("SR,A", 3) + # sometimes the SR,A,Auto comes from 3rd or 4th response + initial_amps_command_3 = get_command_by_value_and_number("SR,A", 3) + initial_amps_command_4 = get_command_by_value_and_number("SR,A", 4) initial_volts_command = get_command_by_value_and_number("SR,V", 3) - assert ( - initial_amps_command == f"SR,A,{initial_amps}" - ), f"Do not set Amps range as initial. Expected 'SR,A,{initial_amps}', got {initial_amps_command!r}." + (initial_amps_command_3 == f"SR,A,{initial_amps}") or (initial_amps_command_4 == f"SR,A,{initial_amps}") + ), f"Do not set Amps range as initial. Expected 'SR,A,{initial_amps}', got {initial_amps_command_3!r} and {initial_amps_command_4!r}." assert ( initial_volts_command == f"SR,V,{initial_volts}" ), f"Do not set Volts range as initial. Expected 'SR,V,{initial_volts}', got {initial_volts_command!r}." From 3785ea13643f39b8a48c78040e004c7d7c9cd7a4 Mon Sep 17 00:00:00 2001 From: vimalnakum Date: Thu, 20 Feb 2025 13:44:13 -0800 Subject: [PATCH 2/2] black changes --- compliance/check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compliance/check.py b/compliance/check.py index fc24f9c..c723adb 100755 --- a/compliance/check.py +++ b/compliance/check.py @@ -266,8 +266,8 @@ def get_command_by_value_and_number(cmd: str, number: int) -> Optional[str]: initial_amps_command_3 = get_command_by_value_and_number("SR,A", 3) initial_amps_command_4 = get_command_by_value_and_number("SR,A", 4) initial_volts_command = get_command_by_value_and_number("SR,V", 3) - assert ( - (initial_amps_command_3 == f"SR,A,{initial_amps}") or (initial_amps_command_4 == f"SR,A,{initial_amps}") + assert (initial_amps_command_3 == f"SR,A,{initial_amps}") or ( + initial_amps_command_4 == f"SR,A,{initial_amps}" ), f"Do not set Amps range as initial. Expected 'SR,A,{initial_amps}', got {initial_amps_command_3!r} and {initial_amps_command_4!r}." assert ( initial_volts_command == f"SR,V,{initial_volts}"