-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
106 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
31 changes: 31 additions & 0 deletions
31
tests/flytekit/unit/use_scenarios/unit_testing/test_type_hints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
|
||
from flytekit.sdk.test_utils import flyte_test | ||
from flytekit.sdk.tasks import python_task | ||
from flytekit.annotated.type_engine import outputs | ||
|
||
@flyte_test | ||
def test_simple_input_output(): | ||
@python_task | ||
def my_task(ctx, a: int) -> outputs(b=int, c=str): | ||
return a+2, "hello world" | ||
|
||
assert my_task.unit_test(a=3) == {'b': 5, 'c': 'hello world'} | ||
|
||
|
||
@flyte_test | ||
def test_simple_input_no_output(): | ||
@python_task | ||
def my_task(ctx, a: int): | ||
pass | ||
|
||
assert my_task.unit_test(a=3) == {} | ||
|
||
|
||
@flyte_test | ||
def test_single_output(): | ||
@python_task | ||
def my_task(ctx) -> str: | ||
return "Hello world" | ||
|
||
assert my_task.unit_test() == {'output': 'Hello world'} |