-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add str tests, fix for falsey boolean coercion
Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
- Loading branch information
1 parent
c6c9d45
commit cb8417c
Showing
7 changed files
with
138 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from pathlib import Path | ||
|
||
from hera.workflows import Parameter, Workflow, script | ||
|
||
try: | ||
from hera.workflows.io.v2 import ( # type: ignore | ||
RunnerInput, | ||
RunnerOutput, | ||
) | ||
except ImportError: | ||
from hera.workflows.io.v1 import ( # type: ignore | ||
RunnerInput, | ||
RunnerOutput, | ||
) | ||
|
||
try: | ||
from typing import Annotated # type: ignore | ||
except ImportError: | ||
from typing_extensions import Annotated # type: ignore | ||
|
||
|
||
class ParamOnlyInput(RunnerInput): | ||
my_str: str | ||
my_empty_default_str: str = "" | ||
my_annotated_str: Annotated[str, Parameter(name="alt-name")] = "hello world!" | ||
|
||
|
||
class ParamOnlyOutput(RunnerOutput): | ||
my_output_str: str = "my-default-str" | ||
another_output: Annotated[Path, Parameter(name="second-output")] | ||
|
||
|
||
@script(constructor="runner") | ||
def pydantic_io_params( | ||
my_input: ParamOnlyInput, | ||
) -> ParamOnlyOutput: | ||
pass | ||
|
||
|
||
with Workflow(generate_name="pydantic-io-") as w: | ||
pydantic_io_params() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from pathlib import Path | ||
|
||
from hera.workflows import Parameter, Workflow, script | ||
from hera.workflows.io.v1 import RunnerInput, RunnerOutput | ||
|
||
try: | ||
from typing import Annotated # type: ignore | ||
except ImportError: | ||
from typing_extensions import Annotated # type: ignore | ||
|
||
|
||
class ParamOnlyInput(RunnerInput): | ||
my_str: str | ||
my_empty_default_str: str = "" | ||
my_annotated_str: Annotated[str, Parameter(name="alt-name")] = "hello world!" | ||
|
||
|
||
class ParamOnlyOutput(RunnerOutput): | ||
my_output_str: str = "my-default-str" | ||
another_output: Annotated[Path, Parameter(name="second-output")] | ||
|
||
|
||
@script(constructor="runner") | ||
def pydantic_io_params( | ||
my_input: ParamOnlyInput, | ||
) -> ParamOnlyOutput: | ||
pass | ||
|
||
|
||
with Workflow(generate_name="pydantic-io-") as w: | ||
pydantic_io_params() |
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