Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh352 committed Feb 13, 2025
1 parent 0038111 commit 0095077
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 10 additions & 2 deletions cffi/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,16 @@ static LY_ERR pyly_backlinks_find_leafref_nodes_clb(struct lysc_node *node, void
}

for (i=0; i<nleafrefs && !found; i++) {
if (dctx->base_path != NULL && strcmp(leafrefs[i], dctx->base_path) != 0) {
continue;
if (dctx->base_path != NULL) {
if (dctx->include_children) {
if (strncmp(leafrefs[i], dctx->base_path, strlen(dctx->base_path)) != 0) {
continue;
}
} else {
if (strcmp(leafrefs[i], dctx->base_path) != 0) {
continue;
}
}
}
found = 1;
}
Expand Down
7 changes: 4 additions & 3 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,16 +847,17 @@ def test_backlinks_children(self):
"/yolo-leafref-search-extmod:my_extref_list/my_extref_union"
]
refs = self.ctx.backlinks_find_leafref_nodes(
base_path="/yolo-leafref-search:my_list/"
base_path="/yolo-leafref-search:my_list/",
include_children=True
)

expecte.sort()
expected.sort()
refs.sort()
self.assertEqual(expected, refs)

def test_backlinks_xpath_leafrefs(self):
expected = [
"/leafref-search:my_list/leafref-search:my_leaf_string"
"/yolo-leafref-search:my_list/my_leaf_string"
]
refs = self.ctx.backlinks_xpath_leafrefs(
"/yolo-leafref-search-extmod:my_extref_list/my_extref"
Expand Down

0 comments on commit 0095077

Please sign in to comment.