Perform boolean serialization before integer serialization.#368
Perform boolean serialization before integer serialization.#368dthiele wants to merge 3 commits into
Conversation
|
The failed "black checks" from |
#369 would fix those |
|
As there is no change in the unittests, I wonder if this PR has actually any effects, or changes anything. @dthiele , could you please add a test under |
|
I stumbled across this issue, when I accidentally passed a plain |
Looking at the unit test code in https://github.com/robshakir/pyangbind/tree/master/tests/serialise and in my experience using I would suggest you raise an Issue linked to this PR. If other people upvote or comment there, it means it is a common use and this fix is needed. |
|
OK, I found a case (leaf-list of boolean), which triggers the serialization issue and added a corresponding test case. Could you take a look? Note that a convenient comparison via |
|
Thanks @dthiele for checking it. Indeed that sounds like an issue, although practically I guess most users do use We can link the issue to this PR, which helps track what problem is this PR solving. |
Hi,
as a bool is an instance of int in Python (cf. https://peps.python.org/pep-0285/#specification), this PR changes the native type serialization order of YangDataSerialiser.default() so that bool is serialized before int. Otherwise, bools will be serialized as 0 or 1.
Best regards,
Daniel