Skip to content

Commit

Permalink
Maybe bug, maybe bugfix: use default value if null passed
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Dec 17, 2024
1 parent 1d11768 commit 993ad97
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/parser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def parse_tool_version_with_defaults(

def boolean_is_checked(input_source: "InputSource"):
nullable = input_source.get_bool("optional", False)
return input_source.get_bool("checked", None if nullable else False)
return input_source.get_bool_or_none("checked", None if nullable else False)


def boolean_true_and_false_values(input_source, profile: Optional[Union[float, str]] = None) -> Tuple[str, str]:
Expand Down
2 changes: 1 addition & 1 deletion test/functional/tools/parameters/gx_boolean_optional.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cat '$inputs' >> $inputs_json;
<!-- I wish this were null? It is somehow in expression_null_handling_boolean -->
<output name="inputs_json">
<assert_contents>
<has_text text="&quot;parameter&quot;: false" />
<has_text text="&quot;parameter&quot;: null" />
</assert_contents>
</output>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ cat '$inputs' >> $inputs_json;
<param name="parameter" value_json="null" />
<output name="output">
<assert_contents>
<has_line line="false" />
<has_line line="true" />
</assert_contents>
</output>
<!-- I wish this were null? It is somehow in expression_null_handling_boolean -->
<output name="inputs_json">
<assert_contents>
<has_text text="&quot;parameter&quot;: null" />
<has_text text="&quot;parameter&quot;: true" />
</assert_contents>
</output>
</test>
Expand Down

0 comments on commit 993ad97

Please sign in to comment.