Skip to content

Commit

Permalink
Start to work on fixing up 21.01 parameters...
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Oct 16, 2024
1 parent d04d462 commit 7640061
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
8 changes: 6 additions & 2 deletions lib/galaxy/tools/parameters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/galaxy/tools/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 17 additions & 5 deletions lib/galaxy_test/api/test_tool_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 7640061

Please sign in to comment.