Visitar URL original
fix exception string of BranchPythonOperator by eladkal · Pull Request #18623 · apache/airflow · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/operators/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def execute(self, context: Dict):
invalid_task_ids = branches - valid_task_ids
if invalid_task_ids:
raise AirflowException(
f"Branch callable must valid task_ids. Invalid tasks found: {invalid_task_ids}"
f"Branch callable must return valid task_ids. Invalid tasks found: {invalid_task_ids}"
)
self.skip_all_except(context['ti'], branch)
return branch
Expand Down
2 changes: 1 addition & 1 deletion tests/operators/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def test_raise_exception_on_invalid_task_id(self):
self.dag.clear()
with pytest.raises(AirflowException) as ctx:
branch_op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
assert """Branch callable must valid task_ids. Invalid tasks found: {'some_task_id'}""" == str(
assert """Branch callable must return valid task_ids. Invalid tasks found: {'some_task_id'}""" == str(
ctx.value
)

Expand Down