Skip to content

Commit

Permalink
test: passing extra args
Browse files Browse the repository at this point in the history
Signed-off-by: machichima <[email protected]>
  • Loading branch information
machichima committed Feb 22, 2025
1 parent e1f2581 commit 818555f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/flytekit/unit/core/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,34 @@ def wf_mixed_positional_and_keyword_args() -> int:
assert wf_pure_positional_args() == ret
assert wf_mixed_positional_and_keyword_args() == ret


def test_positional_args_workflow_extra_args_or_kwargs():
arg1 = 5
arg2 = 6
ret = 17

@task
def t1(x: int, y: int) -> int:
return x + y * 2

@workflow
def sub_wf(x: int, y: int) -> int:
return t1(x=x, y=y)

@workflow
def wf_pure_args_extra_args() -> int:
return sub_wf(arg1, arg2, arg2)

@workflow
def wf_mixed_positional_and_keyword_args_extra_args() -> int:
return sub_wf(arg1, arg2, y=arg2)

with pytest.raises(AssertionError, match="Received more arguments than expected in function 'tests.flytekit.unit.core.test_serialization.sub_wf'. Expected 2 but got 3"):
wf_pure_args_extra_args()

with pytest.raises(AssertionError, match="Got multiple values for argument 'y' in function 'tests.flytekit.unit.core.test_serialization.sub_wf'"):
wf_mixed_positional_and_keyword_args_extra_args()

def test_positional_args_chained_tasks():
@task
def t1(x: int, y: int) -> int:
Expand Down

0 comments on commit 818555f

Please sign in to comment.