Skip to content

Commit 4b2d714

Browse files
gijzelaerrclaude
andcommitted
Fix mypy errors in test_symbols and server SZL list
- test_symbols.py: use isinstance check for ValueType union - server/__init__.py: avoid bytes/bytearray type mismatch in SZL list Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 94eb573 commit 4b2d714

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

snap7/server/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,10 +1704,10 @@ def _get_szl_data(self, szl_id: int, szl_index: int) -> Optional[bytes]:
17041704
elif szl_id == 0x0000:
17051705
# Return list of available SZL IDs
17061706
available_ids = [0x0000, 0x0011, 0x001C, 0x0131, 0x0232]
1707-
data = b""
1707+
szl_bytes = b""
17081708
for id_val in available_ids:
1709-
data += struct.pack(">H", id_val)
1710-
return data
1709+
szl_bytes += struct.pack(">H", id_val)
1710+
return szl_bytes
17111711

17121712
return None
17131713

tests/test_symbols.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ def test_read_many_single_tag(self) -> None:
407407

408408
table = SymbolTable({"Temp": {"db": 1, "offset": 0, "type": "REAL"}})
409409
values = table.read_many(client, ["Temp"])
410-
assert abs(values["Temp"] - 42.0) < 0.01
410+
temp = values["Temp"]
411+
assert isinstance(temp, float)
412+
assert abs(temp - 42.0) < 0.01
411413

412414
def test_read_many_empty(self) -> None:
413415
client = _make_client()

0 commit comments

Comments
 (0)