Skip to content

Commit

Permalink
Utility used by test_case/workflow model parameter functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Aug 20, 2024
1 parent 2dd6420 commit 56d47f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/galaxy/tool_util/parameters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
flat_state_path,
keys_starting_with,
repeat_inputs_to_array,
validate_explicit_conditional_test_value,
visit_input_values,
)

Expand Down Expand Up @@ -100,6 +101,7 @@
"validate_test_case",
"validate_workflow_step",
"validate_workflow_step_linked",
"validate_explicit_conditional_test_value",
"ToolState",
"TestCaseToolState",
"ToolParameterT",
Expand Down
6 changes: 6 additions & 0 deletions lib/galaxy/tool_util/parameters/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ def repeat_inputs_to_array(flat_state_path: str, inputs: Dict[str, KVT]) -> List
except ValueError:
continue
return params


def validate_explicit_conditional_test_value(test_parameter_name: str, value: Any) -> Optional[Union[str, bool]]:
if value is not None and not isinstance(value, (str, bool)):
raise Exception(f"Invalid conditional test value ({value}) for parameter ({test_parameter_name})")
return cast(Optional[Union[str, bool]], value)

0 comments on commit 56d47f4

Please sign in to comment.