Skip to content

Commit 818555f

Browse files
committed
test: passing extra args
Signed-off-by: machichima <[email protected]>
1 parent e1f2581 commit 818555f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/flytekit/unit/core/test_serialization.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,34 @@ def wf_mixed_positional_and_keyword_args() -> int:
10771077
assert wf_pure_positional_args() == ret
10781078
assert wf_mixed_positional_and_keyword_args() == ret
10791079

1080+
1081+
def test_positional_args_workflow_extra_args_or_kwargs():
1082+
arg1 = 5
1083+
arg2 = 6
1084+
ret = 17
1085+
1086+
@task
1087+
def t1(x: int, y: int) -> int:
1088+
return x + y * 2
1089+
1090+
@workflow
1091+
def sub_wf(x: int, y: int) -> int:
1092+
return t1(x=x, y=y)
1093+
1094+
@workflow
1095+
def wf_pure_args_extra_args() -> int:
1096+
return sub_wf(arg1, arg2, arg2)
1097+
1098+
@workflow
1099+
def wf_mixed_positional_and_keyword_args_extra_args() -> int:
1100+
return sub_wf(arg1, arg2, y=arg2)
1101+
1102+
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"):
1103+
wf_pure_args_extra_args()
1104+
1105+
with pytest.raises(AssertionError, match="Got multiple values for argument 'y' in function 'tests.flytekit.unit.core.test_serialization.sub_wf'"):
1106+
wf_mixed_positional_and_keyword_args_extra_args()
1107+
10801108
def test_positional_args_chained_tasks():
10811109
@task
10821110
def t1(x: int, y: int) -> int:

0 commit comments

Comments
 (0)