diff --git a/src/crewai/task.py b/src/crewai/task.py index 7efaa85eb..ea83b950c 100644 --- a/src/crewai/task.py +++ b/src/crewai/task.py @@ -671,6 +671,7 @@ Follow these guidelines: copied_data = self.model_dump(exclude=exclude) copied_data = {k: v for k, v in copied_data.items() if v is not None} + cloned_context: list["Task"] | None | _NotSpecified if self.context is NOT_SPECIFIED: cloned_context = self.context else: diff --git a/tests/test_task.py b/tests/test_task.py index 83e4ed88b..efc07b33b 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -1271,7 +1271,7 @@ def test_create_directory_false(): assert not resolved_dir.exists() with pytest.raises( - RuntimeError, match="Directory .* does not exist and create_directory is False" + RuntimeError, match=r"Directory .* does not exist and create_directory is False" ): task._save_file("test content")