Skip to content

Commit

Permalink
improved the test to use previous task output
Browse files Browse the repository at this point in the history
Signed-off-by: Ketan Umare <[email protected]>
  • Loading branch information
kumare3 committed Apr 6, 2021
1 parent a364cb5 commit 53ac74c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/flytekit/unit/core/test_type_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,18 +512,23 @@ def my_wf(a: int, b: str) -> (int, str):


def test_wf1_branches_ne():
@task
def t1(a: int) -> int:
return a + 1

@task
def t2(a: str) -> str:
return a

@workflow
def my_wf(a: int, b: str) -> str:
return conditional("test1").if_(a != 5).then(t2(a=b)).else_().fail("Unable to choose branch")
new_a = t1(a=a)
return conditional("test1").if_(new_a != 5).then(t2(a=b)).else_().fail("Unable to choose branch")

with pytest.raises(ValueError):
my_wf(a=5, b="hello")
my_wf(a=4, b="hello")

x = my_wf(a=6, b="hello")
x = my_wf(a=5, b="hello")
assert x == "hello"


Expand Down

0 comments on commit 53ac74c

Please sign in to comment.