Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Sep 23, 2024
1 parent 6c7c551 commit 724218d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- `Workflow.input_tasks` and `Workflow.output_tasks` to access the input and output tasks of a Workflow.
- Ability to pass nested list of `Tasks` to `Structure.tasks` allowing for more declarative Structure definitions.
- Ability to pass nested list of `Tasks` to `Structure.tasks` allowing for more complex declarative Structure definitions.


## [0.32.0] - 2024-09-17
Expand Down
21 changes: 9 additions & 12 deletions tests/unit/structures/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,24 +763,21 @@ def test_run_with_error_artifact_no_fail_fast(self, error_artifact_task, waiting
assert workflow.output is not None

def test_nested_tasks(self):
parent = PromptTask("parent")
child = PromptTask("child")
grandchild = PromptTask("grandchild")
workflow = Workflow(
tasks=[
[parent, child, grandchild],
]
[
PromptTask("parent", id=f"parent_{i}"),
PromptTask("child", id=f"child_{i}", parent_ids=[f"parent_{i}"]),
PromptTask("grandchild", id=f"grandchild_{i}", parent_ids=[f"child_{i}"]),
]
for i in range(3)
],
)

workflow + parent
parent.add_child(child)
child.add_child(grandchild)

workflow.run()

assert parent.state == BaseTask.State.FINISHED
assert child.state == BaseTask.State.FINISHED
assert grandchild.state == BaseTask.State.FINISHED
output_ids = [task.id for task in workflow.output_tasks]
assert output_ids == ["grandchild_0", "grandchild_1", "grandchild_2"]

def test_output_tasks(self):
parent = PromptTask("parent")
Expand Down

0 comments on commit 724218d

Please sign in to comment.