From 0095077a7da6b0011812b4ceee58081f52f6f596 Mon Sep 17 00:00:00 2001 From: Brad House Date: Thu, 13 Feb 2025 11:00:00 -0500 Subject: [PATCH] fix --- cffi/source.c | 12 ++++++++++-- tests/test_schema.py | 7 ++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cffi/source.c b/cffi/source.c index 07b5df6..ad9c5ad 100644 --- a/cffi/source.c +++ b/cffi/source.c @@ -195,8 +195,16 @@ static LY_ERR pyly_backlinks_find_leafref_nodes_clb(struct lysc_node *node, void } for (i=0; ibase_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; } diff --git a/tests/test_schema.py b/tests/test_schema.py index 384d44f..83a8717 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -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"