diff --git a/lib/galaxy/tools/parameters/__init__.py b/lib/galaxy/tools/parameters/__init__.py index 9de78f2fbff5..3fc51b79cbf9 100644 --- a/lib/galaxy/tools/parameters/__init__.py +++ b/lib/galaxy/tools/parameters/__init__.py @@ -454,10 +454,13 @@ def populate_state( current_case = conditional_input.get_current_case(value) group_state = state[conditional_input.name] = {} cast_errors: ParameterValidationErrorsT = {} + incoming_for_conditional = cast( + ToolStateJobInstanceT, incoming.get(conditional_input.name) or {} + ) populate_state( request_context, conditional_input.cases[current_case].inputs, - cast(ToolStateJobInstanceT, incoming.get(conditional_input.name)), + incoming_for_conditional, group_state, cast_errors, context=context, @@ -475,10 +478,11 @@ def populate_state( elif input.type == "section": section_input = cast(Section, input) section_errors: ParameterValidationErrorsT = {} + incoming_for_state = cast(ToolStateJobInstanceT, incoming.get(section_input.name) or {}) populate_state( request_context, section_input.inputs, - cast(ToolStateJobInstanceT, incoming.get(section_input.name)), + incoming_for_state, group_state, section_errors, context=context, diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py index 6dd47e7f9bb4..f5d1d6a5a0bb 100644 --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -802,6 +802,8 @@ def __init__(self, input_datasets: Optional[Dict[str, Any]] = None) -> None: self.identifier_key_dict = {} def identifier(self, dataset_value: str, input_values: Dict[str, str]) -> Optional[str]: + if isinstance(dataset_value, list): + raise TypeError(f"Expected {dataset_value} to be hashable") element_identifier = None if identifier_key := self.identifier_key_dict.get(dataset_value, None): element_identifier = input_values.get(identifier_key, None) diff --git a/lib/galaxy_test/api/test_tool_execute.py b/lib/galaxy_test/api/test_tool_execute.py index 5d8fa315e2a8..315247c76f59 100644 --- a/lib/galaxy_test/api/test_tool_execute.py +++ b/lib/galaxy_test/api/test_tool_execute.py @@ -87,9 +87,11 @@ def test_identifier_map_over_multiple_input_in_conditional( target_history: TargetHistory, required_tool: RequiredTool, tool_input_format: DescribeToolInputs ): hdca = target_history.with_pair() - inputs = tool_input_format.when.flat({ - "outer_cond|input1": hdca.src_dict, - }).when.nested( + inputs = tool_input_format.when.flat( + { + "outer_cond|input1": hdca.src_dict, + } + ).when.nested( { "outer_cond": { "multi_input": True, @@ -115,15 +117,25 @@ def test_identifier_multiple_reduce_in_repeat_new_payload_form( @requires_tool_id("output_action_change_format") -def test_map_over_with_output_format_actions(target_history: TargetHistory, required_tool: RequiredTool): +def test_map_over_with_output_format_actions( + target_history: TargetHistory, required_tool: RequiredTool, tool_input_format: DescribeToolInputs +): hdca = target_history.with_pair() for use_action in ["do", "dont"]: - execute = required_tool.execute.with_inputs( + inputs = tool_input_format.when.flat( { "input_cond|dispatch": use_action, "input_cond|input": {"batch": True, "values": [hdca.src_dict]}, } + ).when.nested( + { + "input_cond": { + "dispatch": use_action, + "input": {"batch": True, "values": [hdca.src_dict]}, + } + } ) + execute = required_tool.execute.with_inputs(inputs) execute.assert_has_n_jobs(2).assert_creates_n_implicit_collections(1) expected_extension = "txt" if (use_action == "do") else "data" execute.assert_has_job(0).with_single_output.with_file_ext(expected_extension)