diff --git a/CHANGELOG.md b/CHANGELOG.md index cfcf8f9448..c00316aa5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/tests/unit/structures/test_workflow.py b/tests/unit/structures/test_workflow.py index eea5c67d4c..d252b3997e 100644 --- a/tests/unit/structures/test_workflow.py +++ b/tests/unit/structures/test_workflow.py @@ -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")