@@ -19,8 +19,9 @@ class OutputModel(BaseModel):
1919def test_subworkflow_yaml_generation ():
2020 """Test that SubworkflowStep generates correct YAML."""
2121 import uuid
22+
2223 suffix = str (uuid .uuid4 ())[:8 ]
23-
24+
2425 @step (name = f"prepare-data-{ suffix } " )
2526 async def prepare_data (ctx : Context , data : InputModel ) -> InputModel :
2627 return InputModel (value = data .value * 2 )
@@ -48,7 +49,7 @@ async def process_result(ctx: Context, data: OutputModel) -> OutputModel:
4849 # Find the subworkflow call step
4950 subworkflow_call = None
5051 for step_item in steps :
51- if any ("call_child_workflow" in str (k ) for k in step_item . keys () ):
52+ if any ("call_child_workflow" in str (k ) for k in step_item ):
5253 subworkflow_call = step_item
5354 break
5455
@@ -66,8 +67,9 @@ async def process_result(ctx: Context, data: OutputModel) -> OutputModel:
6667def test_subworkflow_with_mappings_yaml ():
6768 """Test SubworkflowStep with mappings generates correct YAML."""
6869 import uuid
70+
6971 suffix = str (uuid .uuid4 ())[:8 ]
70-
72+
7173 @step (name = f"setup-{ suffix } " )
7274 async def setup (ctx : Context , data : InputModel ) -> InputModel :
7375 return data
@@ -91,7 +93,7 @@ async def setup(ctx: Context, data: InputModel) -> InputModel:
9193
9294 # Find subworkflow call
9395 for step_item in steps :
94- if any ("call_mapped_workflow" in str (k ) for k in step_item . keys () ):
96+ if any ("call_mapped_workflow" in str (k ) for k in step_item ):
9597 call_step = list (step_item .values ())[0 ]
9698 # Check input mapping applied
9799 assert "argument" in call_step ["args" ]
@@ -102,8 +104,9 @@ async def setup(ctx: Context, data: InputModel) -> InputModel:
102104def test_subworkflow_fire_and_forget_yaml ():
103105 """Test SubworkflowStep in fire-and-forget mode generates correct YAML."""
104106 import uuid
107+
105108 suffix = str (uuid .uuid4 ())[:8 ]
106-
109+
107110 @step (name = f"trigger-{ suffix } " )
108111 async def trigger (ctx : Context , data : InputModel ) -> InputModel :
109112 return data
@@ -115,10 +118,10 @@ async def continue_processing(ctx: Context, data: InputModel) -> OutputModel:
115118 # Create fire-and-forget SubworkflowStep
116119 # For fire-and-forget, we need to set the output model to match input since it doesn't wait
117120 async_sub = SubworkflowStep (
118- workflow_id = "async-workflow" ,
119- input_model = InputModel ,
121+ workflow_id = "async-workflow" ,
122+ input_model = InputModel ,
120123 output_model = InputModel , # Fire-and-forget should pass through the input type
121- wait = False
124+ wait = False ,
122125 )
123126
124127 # Build workflow - note the types flow correctly now
@@ -136,7 +139,7 @@ async def continue_processing(ctx: Context, data: InputModel) -> OutputModel:
136139
137140 # Find async subworkflow call
138141 for step_item in steps :
139- if any ("call_async_workflow" in str (k ) for k in step_item . keys () ):
142+ if any ("call_async_workflow" in str (k ) for k in step_item ):
140143 call_step = list (step_item .values ())[0 ]
141144 assert call_step ["call" ] == "workflows.executeWorkflow"
142145 assert "result" not in call_step # Should NOT wait for result
@@ -146,8 +149,9 @@ async def continue_processing(ctx: Context, data: InputModel) -> OutputModel:
146149def test_workflow_composition_yaml ():
147150 """Test that workflow composition generates correct YAML."""
148151 import uuid
152+
149153 suffix = str (uuid .uuid4 ())[:8 ]
150-
154+
151155 @step (name = f"child-step-yaml-{ suffix } " )
152156 async def child_step (ctx : Context , data : InputModel ) -> OutputModel :
153157 return OutputModel (result = data .value * 2 )
@@ -181,7 +185,7 @@ async def parent_end(ctx: Context, data: OutputModel) -> OutputModel:
181185 # Verify subworkflow call exists
182186 has_subworkflow_call = False
183187 for step_item in steps :
184- if any ("call_child_wf_yaml" in str (k ) for k in step_item . keys () ):
188+ if any ("call_child_wf_yaml" in str (k ) for k in step_item ):
185189 has_subworkflow_call = True
186190 call_step = list (step_item .values ())[0 ]
187191 assert call_step ["call" ] == "workflows.executeWorkflow"
0 commit comments