From 24d50247219e88d1a750643b27e37b68cdfd76af Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:44:10 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- cylc/rose/utilities.py | 4 ++-- tests/unit/test_config_node.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cylc/rose/utilities.py b/cylc/rose/utilities.py index bd41c8c8..47f3b1ad 100644 --- a/cylc/rose/utilities.py +++ b/cylc/rose/utilities.py @@ -193,14 +193,14 @@ def identify_templating_section(config_node): f"You defined:\n\t{'; '.join(defined_sections)}" ) elif defined_sections: - return id_templating_section(list(defined_sections)[0]) + return id_templating_section(defined_sections.pop()) else: return id_templating_section('') def id_templating_section( section: Optional[str] = None, - with_brackets: Optional[bool] = False + with_brackets: bool = False ) -> str: """Return a full template section string.""" templating = None diff --git a/tests/unit/test_config_node.py b/tests/unit/test_config_node.py index cc3d80be..bcd8d422 100644 --- a/tests/unit/test_config_node.py +++ b/tests/unit/test_config_node.py @@ -258,6 +258,7 @@ def test_identify_templating_section(node_, expect, raises): ( ([None], 'template variables'), (['jinja2'], 'jinja2:suite.rc'), + (['jinja2:suite.rc'], 'jinja2:suite.rc'), ([None, True], '[template variables]'), (['jinja2', True], '[jinja2:suite.rc]'), )