From 1e86672f838b655583534537a8080cabb000eb14 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Thu, 2 Nov 2023 17:11:05 +0000 Subject: [PATCH] Allow non-optional integer/float params without ``value`` attribute Previously a tool with such an input would fail to load. Add test tool. --- lib/galaxy/tools/parameters/basic.py | 4 --- test/functional/tools/integer_default.xml | 33 ++++++++++++++++++++++ test/functional/tools/sample_tool_conf.xml | 1 + 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 test/functional/tools/integer_default.xml diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index aeaba75baa2f..5b3d5eb40ee0 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -435,8 +435,6 @@ def __init__(self, tool, input_source): int(self.value) except ValueError: raise ParameterValueError("the attribute 'value' must be an integer", self.name) - elif self.value is None and not self.optional: - raise ParameterValueError("the attribute 'value' must be set for non optional parameters", self.name, None) self.min = input_source.get("min") self.max = input_source.get("max") if self.min: @@ -511,8 +509,6 @@ def __init__(self, tool, input_source): float(self.value) except ValueError: raise ParameterValueError("the attribute 'value' must be a real number", self.name, self.value) - elif self.value is None and not self.optional: - raise ParameterValueError("the attribute 'value' must be set for non optional parameters", self.name, None) if self.min: try: self.min = float(self.min) diff --git a/test/functional/tools/integer_default.xml b/test/functional/tools/integer_default.xml new file mode 100644 index 000000000000..ae8e5dbd15c9 --- /dev/null +++ b/test/functional/tools/integer_default.xml @@ -0,0 +1,33 @@ + + '$out_file1' + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/functional/tools/sample_tool_conf.xml b/test/functional/tools/sample_tool_conf.xml index 6069630972b8..c706069d2bb0 100644 --- a/test/functional/tools/sample_tool_conf.xml +++ b/test/functional/tools/sample_tool_conf.xml @@ -218,6 +218,7 @@ +