From 9e28a55de1a58974ee340ec9725415c971eaa372 Mon Sep 17 00:00:00 2001
From: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
Date: Sat, 13 Jun 2026 14:51:08 +0300
Subject: [PATCH] Remove redundant tests in Task SDK

---
 .../definitions/test_asset_access_control.py  | 10 ---
 .../tests/task_sdk/definitions/test_dag.py    |  5 --
 .../task_sdk/definitions/test_taskgroup.py    | 63 -------------------
 .../task_sdk/definitions/test_wait_policy.py  | 21 -------
 .../task_sdk/execution_time/test_comms.py     | 10 ---
 task-sdk/tests/task_sdk/test_exceptions.py    | 12 ----
 6 files changed, 121 deletions(-)

diff --git a/task-sdk/tests/task_sdk/definitions/test_asset_access_control.py b/task-sdk/tests/task_sdk/definitions/test_asset_access_control.py
index 1abe295306c7f..6a1dab77ac2ac 100644
--- a/task-sdk/tests/task_sdk/definitions/test_asset_access_control.py
+++ b/task-sdk/tests/task_sdk/definitions/test_asset_access_control.py
@@ -28,16 +28,6 @@ def test_defaults(self):
         assert ac.consumer_teams is None
         assert ac.allow_global is True
 
-    def test_explicit_values(self):
-        ac = AssetAccessControl(
-            producer_teams=["team_a", "team_b"],
-            consumer_teams=["team_c"],
-            allow_global=False,
-        )
-        assert ac.producer_teams == ["team_a", "team_b"]
-        assert ac.consumer_teams == ["team_c"]
-        assert ac.allow_global is False
-
     @pytest.mark.parametrize(
         "teams",
         [
diff --git a/task-sdk/tests/task_sdk/definitions/test_dag.py b/task-sdk/tests/task_sdk/definitions/test_dag.py
index c42eb8dfc80a1..8b86c9f61ef06 100644
--- a/task-sdk/tests/task_sdk/definitions/test_dag.py
+++ b/task-sdk/tests/task_sdk/definitions/test_dag.py
@@ -990,8 +990,3 @@ def test_getitem_missing_raises_node_not_found(self):
         dag = DAG("test_dag", schedule=None, start_date=DEFAULT_DATE)
         with pytest.raises(NodeNotFound):
             dag["nonexistent"]
-
-    def test_getitem_missing_is_key_error(self):
-        dag = DAG("test_dag", schedule=None, start_date=DEFAULT_DATE)
-        with pytest.raises(KeyError):
-            dag["nonexistent"]
diff --git a/task-sdk/tests/task_sdk/definitions/test_taskgroup.py b/task-sdk/tests/task_sdk/definitions/test_taskgroup.py
index d11f8eb3632b3..afbbb2e1e8876 100644
--- a/task-sdk/tests/task_sdk/definitions/test_taskgroup.py
+++ b/task-sdk/tests/task_sdk/definitions/test_taskgroup.py
@@ -272,40 +272,6 @@ def test_taskgroup_getitem_returns_child_by_label(prefix: bool):
         group1["nonexistent"]
 
 
-def test_build_task_group_with_prefix_functionality():
-    """
-    Tests TaskGroup prefix_group_id functionality - additional test for comprehensive coverage.
-    """
-    logical_date = pendulum.parse("20200101")
-    with DAG("test_prefix_functionality", start_date=logical_date):
-        task1 = EmptyOperator(task_id="task1")
-        with TaskGroup("group234", prefix_group_id=False) as group234:
-            task2 = EmptyOperator(task_id="task2")
-
-            with TaskGroup("group34") as group34:
-                task3 = EmptyOperator(task_id="task3")
-
-                with TaskGroup("group4", prefix_group_id=False) as group4:
-                    task4 = EmptyOperator(task_id="task4")
-
-        task5 = EmptyOperator(task_id="task5")
-        task1 >> group234
-        group34 >> task5
-
-    # Test prefix_group_id behavior
-    assert task2.task_id == "task2"  # prefix_group_id=False, so no prefix
-    assert group34.group_id == "group34"  # nested group gets prefixed
-    assert task3.task_id == "group34.task3"  # task in nested group gets full prefix
-    assert group4.group_id == "group34.group4"  # nested group gets parent prefix
-    assert task4.task_id == "task4"  # prefix_group_id=False, so no prefix
-    assert task5.task_id == "task5"  # root level task, no prefix
-
-    # Test group hierarchy and child access
-    assert group234.get_child_by_label("task2") == task2
-    assert group234.get_child_by_label("group34") == group34
-    assert group4.get_child_by_label("task4") == task4
-
-
 def test_build_task_group_with_task_decorator():
     """
     Test that TaskGroup can be used with the @task decorator.
@@ -579,24 +545,6 @@ def test_iter_tasks():
     ]
 
 
-def test_override_dag_default_args():
-    logical_date = pendulum.parse("20201109")
-    with DAG(
-        dag_id="example_task_group_default_args",
-        schedule=None,
-        start_date=logical_date,
-        default_args={"owner": "dag"},
-    ):
-        with TaskGroup("group1", default_args={"owner": "group"}):
-            task_1 = EmptyOperator(task_id="task_1")
-            task_2 = EmptyOperator(task_id="task_2", owner="task")
-            task_3 = EmptyOperator(task_id="task_3", default_args={"owner": "task"})
-
-            assert task_1.owner == "group"
-            assert task_2.owner == "task"
-            assert task_3.owner == "task"
-
-
 def test_override_dag_default_args_in_nested_tg():
     logical_date = pendulum.parse("20201109")
     with DAG(
@@ -970,17 +918,6 @@ def test_getitem_missing_raises_node_not_found(self):
         with pytest.raises(NodeNotFound):
             tg["nonexistent"]
 
-    def test_getitem_missing_is_key_error(self):
-        import pendulum
-
-        start = pendulum.datetime(2016, 1, 1)
-        with DAG("test_dag", schedule=None, start_date=start):
-            with TaskGroup(group_id="section") as tg:
-                pass
-
-        with pytest.raises(KeyError):
-            tg["nonexistent"]
-
 
 # --- topological_sort: cross-shape correctness ---
 #
diff --git a/task-sdk/tests/task_sdk/definitions/test_wait_policy.py b/task-sdk/tests/task_sdk/definitions/test_wait_policy.py
index 5ddbb82782f84..0c8cb967771bc 100644
--- a/task-sdk/tests/task_sdk/definitions/test_wait_policy.py
+++ b/task-sdk/tests/task_sdk/definitions/test_wait_policy.py
@@ -22,35 +22,14 @@
 
 
 class TestSdkWaitForAll:
-    def test_repr(self):
-        assert repr(WaitForAll()) == "WaitForAll()"
-
-    def test_eq(self):
-        assert WaitForAll() == WaitForAll()
-
     def test_neq_other_policy(self):
         assert WaitForAll() != MinimumCount(1)
 
-    def test_hash_consistent(self):
-        assert hash(WaitForAll()) == hash(WaitForAll())
-
 
 class TestSdkMinimumCount:
-    def test_stores_n(self):
-        assert MinimumCount(5).n == 5
-
-    def test_eq_same_n(self):
-        assert MinimumCount(5) == MinimumCount(5)
-
     def test_neq_different_n(self):
         assert MinimumCount(5) != MinimumCount(6)
 
-    def test_repr(self):
-        assert repr(MinimumCount(5)) == "MinimumCount(n=5)"
-
-    def test_hash_consistent(self):
-        assert hash(MinimumCount(5)) == hash(MinimumCount(5))
-
     def test_zero_rejected(self):
         with pytest.raises(ValueError, match="MinimumCount\\(0\\) is degenerate"):
             MinimumCount(0)
diff --git a/task-sdk/tests/task_sdk/execution_time/test_comms.py b/task-sdk/tests/task_sdk/execution_time/test_comms.py
index 51782796b825b..2463487e4c38d 100644
--- a/task-sdk/tests/task_sdk/execution_time/test_comms.py
+++ b/task-sdk/tests/task_sdk/execution_time/test_comms.py
@@ -60,16 +60,6 @@ def test_mask_secret_with_objects(self, object_to_mask):
         mask_secret_object = MaskSecret(value=object_to_mask, name="test_secret")
         assert mask_secret_object.value == object_to_mask
 
-    def test_mask_secret_with_list(self):
-        example_dict = ["test"]
-        mask_secret_object = MaskSecret(value=example_dict, name="test_secret")
-        assert mask_secret_object.value == example_dict
-
-    def test_mask_secret_with_iterable(self):
-        example_dict = ["test"]
-        mask_secret_object = MaskSecret(value=example_dict, name="test_secret")
-        assert mask_secret_object.value == example_dict
-
 
 class TestCommsDecoder:
     """Test the communication between the subprocess and the "supervisor"."""
diff --git a/task-sdk/tests/task_sdk/test_exceptions.py b/task-sdk/tests/task_sdk/test_exceptions.py
index 2a1b5d5a683ca..d9be64f0e0b0d 100644
--- a/task-sdk/tests/task_sdk/test_exceptions.py
+++ b/task-sdk/tests/task_sdk/test_exceptions.py
@@ -16,8 +16,6 @@
 # under the License.
 from __future__ import annotations
 
-import pytest
-
 from airflow.sdk.exceptions import NodeNotFound, TaskNotFound
 
 
@@ -29,15 +27,5 @@ def test_node_not_found_is_subclass_of_key_error():
     assert issubclass(NodeNotFound, KeyError)
 
 
-def test_node_not_found_caught_as_key_error():
-    with pytest.raises(KeyError):
-        raise NodeNotFound("missing_task")
-
-
-def test_node_not_found_caught_as_task_not_found():
-    with pytest.raises(TaskNotFound):
-        raise NodeNotFound("missing_task")
-
-
 def test_node_not_found_str_suppresses_key_error_repr():
     assert str(NodeNotFound("missing")) == "missing"
