Skip to content

Commit

Permalink
Add a new test based on issue stlehmann#440
Browse files Browse the repository at this point in the history
  • Loading branch information
msfur committed Jan 13, 2025
1 parent a9bf970 commit 4a5eb88
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,23 @@ def test_bytes_from_dict(self) -> None:
# fmt: on
self.assertEqual(bytes_list, pyads.bytes_from_dict(values, structure_def))

# test single nested structure (issue #440)
structure_def = (
('iVar9', pyads.PLCTYPE_USINT, 1),
('structVar', substructure_def, 1),
)
values = OrderedDict(
[
("iVar9", 29),
("structVar", subvalues)
]
)
# fmt: off
bytes_list = [29] + subbytes_list

# fmt: on
self.assertEqual(bytes_list, pyads.bytes_from_dict(values, structure_def))

def test_dict_slice_generator(self):
"""test _dict_slice_generator function."""
test_dict = {
Expand Down

0 comments on commit 4a5eb88

Please sign in to comment.