Skip to content

Commit

Permalink
fix checking for non-int args.
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Jun 12, 2024
1 parent b1b0424 commit bf03e15
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions cylc/flow/xtriggers/workflow_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ def validate(args: Dict[str, Any]):
raise WorkflowConfigError(
"Full ID needed: workflow//cycle/task[:selector].")

try:
int(args["flow_num"])
except ValueError:
if not isinstance(args["flow_num"], int):
raise WorkflowConfigError("flow_num must be an integer.")


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/xtriggers/test_workflow_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def test_validate_fail_bad_id(id_):

def test_validate_fail_non_int_flow():
"""Validate returns ok with valid args."""
with pytest.raises(ValueError, match='must be an integer'):
with pytest.raises(WorkflowConfigError, match='must be an integer'):
validate({
'workflow_task_id': 'foo//1/bar',
'offset': 'PT1H',
Expand Down

0 comments on commit bf03e15

Please sign in to comment.