Skip to content

Commit e5f3e8b

Browse files
committed
style: apply consistent code formatting to test files
improve code readability with proper formatting
1 parent 17ed32e commit e5f3e8b

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

tests/codegen/test_subworkflow_codegen.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ class OutputModel(BaseModel):
1919
def 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:
6667
def 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:
102104
def 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:
146149
def 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"

tests/unit/test_subworkflow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def parent_step2(ctx: Context, data: OutputModel) -> OutputModel:
7474

7575
# Create child workflow
7676
child_wf = (workflow(f"child-workflow-{suffix}") >> child_step).build()
77-
77+
7878
# Create parent workflow that uses child
7979
parent_wf = (
8080
workflow(f"parent-workflow-{suffix}")
@@ -118,12 +118,12 @@ async def s2(ctx: Context, data: OutputModel) -> OutputModel:
118118
@step(name=f"s3-{suffix}")
119119
async def s3(ctx: Context, data: OutputModel) -> InputModel:
120120
return InputModel(value=data.result)
121-
121+
122122
# Create multiple workflows
123123
wf1 = (workflow("wf1") >> s1).build()
124124
wf2 = (workflow("wf2") >> s1).build()
125-
wf3 = (workflow("wf3") >> s1 >> s3 >> wf1 >> s2).build() # wf3 depends on wf1
126-
wf4 = (workflow("wf4") >> s1 >> s3 >> wf2 >> s3 >> wf1 >> s2).build() # wf4 depends on wf1 and wf2
125+
(workflow("wf3") >> s1 >> s3 >> wf1 >> s2).build() # wf3 depends on wf1
126+
(workflow("wf4") >> s1 >> s3 >> wf2 >> s3 >> wf1 >> s2).build() # wf4 depends on wf1 and wf2
127127

128128
# Get dependency graph
129129
deps = get_workflow_dependencies()

0 commit comments

Comments
 (0)