Skip to content

Commit 0095077

Browse files
committed
fix
1 parent 0038111 commit 0095077

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

cffi/source.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,16 @@ static LY_ERR pyly_backlinks_find_leafref_nodes_clb(struct lysc_node *node, void
195195
}
196196

197197
for (i=0; i<nleafrefs && !found; i++) {
198-
if (dctx->base_path != NULL && strcmp(leafrefs[i], dctx->base_path) != 0) {
199-
continue;
198+
if (dctx->base_path != NULL) {
199+
if (dctx->include_children) {
200+
if (strncmp(leafrefs[i], dctx->base_path, strlen(dctx->base_path)) != 0) {
201+
continue;
202+
}
203+
} else {
204+
if (strcmp(leafrefs[i], dctx->base_path) != 0) {
205+
continue;
206+
}
207+
}
200208
}
201209
found = 1;
202210
}

tests/test_schema.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,16 +847,17 @@ def test_backlinks_children(self):
847847
"/yolo-leafref-search-extmod:my_extref_list/my_extref_union"
848848
]
849849
refs = self.ctx.backlinks_find_leafref_nodes(
850-
base_path="/yolo-leafref-search:my_list/"
850+
base_path="/yolo-leafref-search:my_list/",
851+
include_children=True
851852
)
852853

853-
expecte.sort()
854+
expected.sort()
854855
refs.sort()
855856
self.assertEqual(expected, refs)
856857

857858
def test_backlinks_xpath_leafrefs(self):
858859
expected = [
859-
"/leafref-search:my_list/leafref-search:my_leaf_string"
860+
"/yolo-leafref-search:my_list/my_leaf_string"
860861
]
861862
refs = self.ctx.backlinks_xpath_leafrefs(
862863
"/yolo-leafref-search-extmod:my_extref_list/my_extref"

0 commit comments

Comments
 (0)