From 477a1a1e99295f56b4807f2be5ea7e2ff32a43ec Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sun, 11 Aug 2024 09:57:50 -0400 Subject: [PATCH] Rebase into test case commit. --- lib/galaxy/tool_util/parameters/case.py | 10 +++++ test/functional/tools/section_24_2.xml | 43 +++++++++++++++++++ .../tool_util/test_parameter_test_cases.py | 18 +++----- 3 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 test/functional/tools/section_24_2.xml diff --git a/lib/galaxy/tool_util/parameters/case.py b/lib/galaxy/tool_util/parameters/case.py index 4d97bcd87489..5c79bbbb7974 100644 --- a/lib/galaxy/tool_util/parameters/case.py +++ b/lib/galaxy/tool_util/parameters/case.py @@ -28,6 +28,7 @@ FloatParameterModel, IntegerParameterModel, RepeatParameterModel, + SectionParameterModel, ToolParameterT, ) from .state import TestCaseToolState @@ -235,6 +236,15 @@ def _merge_into_state( repeat.parameters, inputs, repeat_state_array[i], profile, warnings, repeat_instance_prefix ) ) + elif isinstance(tool_input, (SectionParameterModel,)): + section_state = state_at_level.get(input_name, {}) + if input_name not in state_at_level: + state_at_level[input_name] = section_state + + section = cast(SectionParameterModel, tool_input) + handled_inputs.update( + _merge_level_into_state(section.parameters, inputs, section_state, profile, warnings, state_path) + ) else: test_input = _input_for(state_path, inputs) if test_input is not None: diff --git a/test/functional/tools/section_24_2.xml b/test/functional/tools/section_24_2.xml new file mode 100644 index 000000000000..ec62f0fd8ee9 --- /dev/null +++ b/test/functional/tools/section_24_2.xml @@ -0,0 +1,43 @@ + + '$out_file1' && +echo $float.floattest >> '$out_file1' + ]]> + +
+ +
+
+ +
+
+ + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+
+
diff --git a/test/unit/tool_util/test_parameter_test_cases.py b/test/unit/tool_util/test_parameter_test_cases.py index b435d1923243..640b20fc7dd0 100644 --- a/test/unit/tool_util/test_parameter_test_cases.py +++ b/test/unit/tool_util/test_parameter_test_cases.py @@ -1,4 +1,5 @@ import os +import re from typing import List from galaxy.tool_util.models import parse_tool @@ -77,21 +78,14 @@ def _assert_tool_test_parsing_only_fails_with_newer_profile(tmp_path, filename: new_path = tmp_path / filename with open(original_path) as rf: tool_contents = rf.read() - import re - - tool_contents = re.sub('profile=".*"', r"", tool_contents) - print(tool_contents) + tool_contents = re.sub(r'profile="[\d\.]*"', r"", tool_contents) new_profile_contents = tool_contents.replace("