Skip to content

Fix find_children_w_parents to include only real descendants - #900

Open
kat-git-hub wants to merge 1 commit into
networktocode:developfrom
kat-git-hub:fix-find-children-w-parents
Open

Fix find_children_w_parents to include only real descendants#900
kat-git-hub wants to merge 1 commit into
networktocode:developfrom
kat-git-hub:fix-find-children-w-parents

Conversation

@kat-git-hub

Copy link
Copy Markdown
Contributor

Fixes #836

find_children_w_parents grouped lines by their top level parent instead of the actual matched line. So matching one child pulled in every sibling under the same parent, even ones that don't match the pattern at all.

Example from the issue:

parsed.find_children_w_parents(parent_pattern="context local", child_pattern=" logging", match_type="regex")

Before it also returned "something not logging". Now only the two logging lines come back.

Also updated the existing ios_full_received.txt fixture. It expected contact-email-addr to be included alongside profile "CiscoTAC-1", but contact-email-addr doesn't match the test's child_pattern at all, it's just a sibling under call-home. Same bug, just baked into the expected test output. Added a separate flat_siblings test case for the exact issue scenario.

@jeffkala

jeffkala commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution @kat-git-hub; how is this PR different than #837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: BaseSpaceConfigParser.find_children_w_parents()

2 participants