From 2811c1fba17c73e644dbafaf721711eba7a479ec Mon Sep 17 00:00:00 2001 From: jtdub Date: Thu, 19 Mar 2026 20:24:19 -0500 Subject: [PATCH] Fix XR tests for exit_text_parent_level and update group rule Update three tests to expect unindented exit text (end-policy, end-template) now that exit_text_parent_level=True is set on XR sectional exiting rules. Also add exit_text_parent_level=True to the group/end-group rule for consistency. Co-Authored-By: Claude Opus 4.6 (1M context) --- hier_config/platforms/cisco_xr/driver.py | 1 + tests/test_driver_cisco_xr.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hier_config/platforms/cisco_xr/driver.py b/hier_config/platforms/cisco_xr/driver.py index 806145b..57d6781 100644 --- a/hier_config/platforms/cisco_xr/driver.py +++ b/hier_config/platforms/cisco_xr/driver.py @@ -84,6 +84,7 @@ def _instantiate_rules() -> HConfigDriverRules: SectionalExitingRule( match_rules=(MatchRule(startswith="group"),), exit_text="end-group", + exit_text_parent_level=True, ), SectionalExitingRule( match_rules=(MatchRule(startswith="interface"),), diff --git a/tests/test_driver_cisco_xr.py b/tests/test_driver_cisco_xr.py index ae029e8..cfc808f 100644 --- a/tests/test_driver_cisco_xr.py +++ b/tests/test_driver_cisco_xr.py @@ -156,7 +156,7 @@ def test_nested_if_endif_route_policy() -> None: " exit", " endif", " pass", - " end-policy", + "end-policy", ) @@ -215,7 +215,7 @@ def test_flow_exporter_template_indent_adjust() -> None: " exit", " endif", " drop", - " end-policy", + "end-policy", ) @@ -288,7 +288,7 @@ def test_template_block_indent_adjust() -> None: " transmit", " receive", " exit", - " end-template", + "end-template", )