From 133e7f5c70b0332b245ee6caee5bfbd0cbdc47d1 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 18 Dec 2024 20:23:46 +0100 Subject: [PATCH] Fix `test_run_with_optional_data_unspecified_survives_delayed_step` --- lib/galaxy/tools/parameters/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/galaxy/tools/parameters/__init__.py b/lib/galaxy/tools/parameters/__init__.py index 04c968910b45..7281067f9a47 100644 --- a/lib/galaxy/tools/parameters/__init__.py +++ b/lib/galaxy/tools/parameters/__init__.py @@ -175,6 +175,17 @@ def callback_helper(input, input_values, name_prefix, label_prefix, parent_prefi if input.name not in input_values: args["error"] = f"No value found for '{args.get('prefixed_label')}'." new_value = callback(**args) + + # is this good enough ? feels very ugh + if new_value == [no_replacement_value]: + # Single unspecified value in multiple="true" input with a single null input, pretend it's a singular value + new_value = no_replacement_value + if isinstance(new_value, list): + # Maybe mixed input, I guess tool defaults don't really make sense here ? + # Would e.g. be default dataset in multiple="true" input, you wouldn't expect the default to be inserted + # if other inputs are connected and provided. + new_value = [item if not item == no_replacement_value else None for item in new_value] + if no_replacement_value is REPLACE_ON_TRUTHY: replace = bool(new_value) else: