Skip to content

Commit 77d01eb

Browse files
committed
Complex custom type
1 parent e67ac04 commit 77d01eb

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/contrib/test_pydantic.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -750,19 +750,16 @@ def make_dataclass_objects() -> List[MyDataClass]:
750750
return [MyDataClass(int_field=7)]
751751

752752

753+
ComplexCustomType = Tuple[List[MyDataClass], List[PydanticModels]]
754+
755+
753756
@workflow.defn
754-
class MixedCollectionTypesWorkflow:
757+
class ComplexCustomTypeWorkflow:
755758
@workflow.run
756759
async def run(
757760
self,
758-
input: Tuple[
759-
List[MyDataClass],
760-
List[PydanticModels],
761-
],
762-
) -> Tuple[
763-
List[MyDataClass],
764-
List[PydanticModels],
765-
]:
761+
input: ComplexCustomType,
762+
) -> ComplexCustomType:
766763
data_classes, pydantic_objects = input
767764
pydantic_objects = await workflow.execute_activity(
768765
pydantic_models_activity,
@@ -772,7 +769,7 @@ async def run(
772769
return data_classes, pydantic_objects
773770

774771

775-
async def test_mixed_collection_types(client: Client):
772+
async def test_complex_custom_type(client: Client):
776773
new_config = client.config()
777774
new_config["data_converter"] = pydantic_data_converter
778775
client = Client(**new_config)
@@ -784,14 +781,14 @@ async def test_mixed_collection_types(client: Client):
784781
async with Worker(
785782
client,
786783
task_queue=task_queue_name,
787-
workflows=[MixedCollectionTypesWorkflow],
784+
workflows=[ComplexCustomTypeWorkflow],
788785
activities=[pydantic_models_activity],
789786
):
790787
(
791788
round_tripped_dataclass_objects,
792789
round_tripped_pydantic_objects,
793790
) = await client.execute_workflow(
794-
MixedCollectionTypesWorkflow.run,
791+
ComplexCustomTypeWorkflow.run,
795792
(orig_dataclass_objects, orig_pydantic_objects),
796793
id=str(uuid.uuid4()),
797794
task_queue=task_queue_name,

0 commit comments

Comments
 (0)