robshakir / pyangbind

A plugin for pyang that creates Python bindings for a YANG model.
Other
203 stars 121 forks source link

Don't prefix a property value that is already prefixed #313

Closed fperrin closed 1 year ago

fperrin commented 1 year ago

This is a rebase of @markuscraig's PR #213 over the most recent master (original PR has a conflict when rebasing), plus a testcase that exhibits the issue.

Without the fix, testcase test_json_ietf_serialise_namespace_handling_remote fails with:

>               self.assertEqual(
                    data["identityref:ietfint"]["ref"],
                    "remote-two:remote-id",
                )
E               AssertionError: 'remote-two:remote-two:remote-id' != 'remote-two:remote-id'
E               - remote-two:remote-two:remote-id
E               ? -----------
E               + remote-two:remote-id

Reference: https://www.ietf.org/rfc/rfc6020.txt sections 9.10.*