mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix optional integer/float comparisons
Neither of them can be cast to int/float respectively.
Fixes test 3 in bowtie2, which errors with:
```
2019-12-19 17:11:34,022 ERROR [galaxy.jobs.runners] (12) Failure preparing job
Traceback (most recent call last):
File "/Users/mvandenb/src/galaxy/lib/galaxy/util/__init__.py", line 1039, in unicodify
value = text_type(value)
File "/Users/mvandenb/src/galaxy/.venv/lib/python3.6/site-packages/Cheetah/Template.py", line 1053, in __unicode__
return getattr(self, mainMethName)()
File "cheetah_DynamicallyCompiledCheetahTemplate_1576771894_0091798_17143.py", line 680, in respond
File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 94, in __ne__
return not self == other
File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 91, in __eq__
return self._get_cast_value(other) == other
File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 88, in _get_cast_value
return cast.get(self.input.type, str)(self)
File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 117, in __int__
return int(float(self))
File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 120, in __float__
return float(str(self))
ValueError: could not convert string to float:
```
This commit is contained in:
@@ -83,7 +83,7 @@ class InputValueWrapper(ToolParameterValueWrapper):
|
||||
if self.input.type == 'boolean' and isinstance(other, string_types):
|
||||
return str(self)
|
||||
# For backward compatibility, allow `$wrapper != ""` for optional non-text param
|
||||
if self.input.optional and self.value is None and isinstance(other, string_types):
|
||||
if self.input.optional and self.value is None and self.input.type != 'boolean':
|
||||
return str(self)
|
||||
cast = {
|
||||
'text': str,
|
||||
|
||||
Reference in New Issue
Block a user