Add SCPI parser tests
Comprehensive test suite for SCPI command parsing: - SCPICommand dataclass tests (creation, keyword property) - Parser tests for queries, commands, arguments - IEEE 488.2 common command tests (*IDN?, *RST, etc.) - Edge cases (whitespace, empty strings) - Instrument-specific command tests Also fixed bug where is_query was determined from command string ending rather than header ending (handles queries with arguments).
This commit is contained in:
@@ -67,8 +67,6 @@ class SCPIParser:
|
||||
if not command_string:
|
||||
return SCPICommand(header="", arguments=[], is_query=False)
|
||||
|
||||
is_query = command_string.endswith("?")
|
||||
|
||||
# Split into header and arguments on first whitespace
|
||||
parts = command_string.split(None, 1)
|
||||
header = parts[0]
|
||||
@@ -79,6 +77,9 @@ class SCPIParser:
|
||||
arg_string = parts[1]
|
||||
arguments = [arg.strip() for arg in arg_string.split(",")]
|
||||
|
||||
# Query is determined by whether the header ends with '?'
|
||||
is_query = header.endswith("?")
|
||||
|
||||
return SCPICommand(
|
||||
header=header,
|
||||
arguments=arguments,
|
||||
|
||||
Reference in New Issue
Block a user