-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
- Loading branch information
1 parent
8a6a8a4
commit f321ba6
Showing
1 changed file
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from __future__ import annotations | ||
|
||
import typing | ||
from dataclasses import dataclass | ||
|
||
from dataclasses_json import dataclass_json | ||
|
||
from flytekit.core import context_manager | ||
from flytekit.core.context_manager import Image, ImageConfig | ||
from flytekit.core.task import task | ||
|
||
serialization_settings = context_manager.SerializationSettings( | ||
project="proj", | ||
domain="dom", | ||
version="123", | ||
image_config=ImageConfig(Image(name="name", fqn="asdf/fdsa", tag="123")), | ||
env={}, | ||
) | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class Foo(object): | ||
x: int | ||
y: str | ||
z: typing.Dict[str, str] | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class Bar(object): | ||
x: int | ||
y: str | ||
z: Foo | ||
|
||
|
||
@task | ||
def t1() -> Foo: | ||
return Foo(x=1, y="foo", z={"hello": "world"}) | ||
|
||
|
||
def test_guess_dict4(): | ||
print(t1.interface.outputs["o0"]) | ||
assert t1.interface.outputs["o0"].type.metadata["definitions"]["FooSchema"] is not None |