This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 6ef80e8be1 Combine similar if logics in tests (#33986)
6ef80e8be1 is described below
commit 6ef80e8be178e0ab8d119270a28b23d0bf47ed62
Author: Hussein Awala <[email protected]>
AuthorDate: Sun Sep 3 22:09:59 2023 +0200
Combine similar if logics in tests (#33986)
---
tests/operators/test_branch_operator.py | 4 +---
tests/providers/common/sql/operators/test_sql.py | 8 ++------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/tests/operators/test_branch_operator.py
b/tests/operators/test_branch_operator.py
index 28b44973a3..c696456e64 100644
--- a/tests/operators/test_branch_operator.py
+++ b/tests/operators/test_branch_operator.py
@@ -160,9 +160,7 @@ class TestBranchOperator:
for ti in tis:
if ti.task_id == "make_choice":
assert ti.state == State.SUCCESS
- elif ti.task_id == "branch_1":
- assert ti.state == State.NONE
- elif ti.task_id == "branch_2":
+ elif ti.task_id in ("branch_1", "branch_2"):
assert ti.state == State.NONE
else:
raise Exception
diff --git a/tests/providers/common/sql/operators/test_sql.py
b/tests/providers/common/sql/operators/test_sql.py
index e80bad08ed..d3c8d65433 100644
--- a/tests/providers/common/sql/operators/test_sql.py
+++ b/tests/providers/common/sql/operators/test_sql.py
@@ -1158,9 +1158,7 @@ class TestSqlBranch:
for ti in tis:
if ti.task_id == "make_choice":
assert ti.state == State.SUCCESS
- elif ti.task_id == "branch_1":
- assert ti.state == State.NONE
- elif ti.task_id == "branch_2":
+ elif ti.task_id in ("branch_1", "branch_2"):
assert ti.state == State.NONE
elif ti.task_id == "branch_3":
assert ti.state == State.SKIPPED
@@ -1231,9 +1229,7 @@ class TestSqlBranch:
for ti in tis:
if ti.task_id == "make_choice":
assert ti.state == State.SUCCESS
- elif ti.task_id == "branch_1":
- assert ti.state == State.NONE
- elif ti.task_id == "branch_2":
+ elif ti.task_id in ("branch_1", "branch_2"):
assert ti.state == State.NONE
else:
raise ValueError(f"Invalid task id {ti.task_id} found!")