Skip to content

Commit

Permalink
Add test for SdoRecord length and iteration count.
Browse files Browse the repository at this point in the history
  • Loading branch information
acolomb committed Aug 17, 2024
1 parent 5cbb00e commit 30c4071
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_sdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ def setUp(self):
node = canopen.LocalNode(1, SAMPLE_EDS)
self.sdo_node = node.sdo

def test_record_iter_length(self):
"""Assume the "highest subindex supported" entry is not counted.
Sub-objects without an OD entry should be skipped as well."""
record = self.sdo_node[0x1018]
subs = sum(1 for _ in iter(record))
self.assertEqual(len(record), 3)
self.assertEqual(subs, 3)

def test_array_iter_length(self):
"""Assume the "highest subindex supported" entry is not counted."""
array = self.sdo_node[0x1003]
Expand Down

0 comments on commit 30c4071

Please sign in to comment.