-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip the "highest subindex" entry when iterating over SdoRecord #538
Skip the "highest subindex" entry when iterating over SdoRecord #538
Conversation
The count entry itself is not part of the data (according to CiA 301), thus should not be yielded from an iterator. That matches the behavior of SdoArray, which also yields only the array contents. Note that the basis of returned record sub-objects is still the subset described by the OD, which might be smaller than the actual entries accessible on the node, and less than indicated by the record's subindex 0. Thus the count (and iteration set) is reduced by one element only if the subindex 0 was actually part of this subset.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #538 +/- ##
=======================================
Coverage 71.16% 71.16%
=======================================
Files 26 26
Lines 3114 3114
Branches 527 527
=======================================
Hits 2216 2216
Misses 766 766
Partials 132 132
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to also update doc/sdo.rst
with a sentence or two similar to the added code comments.
Also, it would be nice with test for this, and by that I mean preferably to add those tests first (in a separate PR), followed by the behavioural changes (this PR) coupled with amendments to the (presumably broken) tests.
Adjust the EDS test accordingly, since the record length only counts sub-objects that have an actual description.
Switch from CompactSubObj to actual sub-entries. Leave out some of the sub-entries, targeting specific SDO tests.
All comments addressed, see #539. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I can confirm that the added tests cover the affected lines, and that test_record_iter_length
expectedly fails if applied on master
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
The count entry itself is not part of the data (according to CiA 301), thus should not be yielded from an iterator. That matches the behavior of SdoArray, which also yields only the array contents.
Note that the basis of returned record sub-objects is still the subset described by the OD, which might be smaller than the actual entries accessible on the node, and less than indicated by the record's subindex 0. Thus the count (and iteration set) is reduced by one element only if the subindex 0 was actually part of this subset.
This supersedes PR #430, with the alternative approach justified in the last comment there.