kaxil commented on code in PR #53000:
URL: https://github.com/apache/airflow/pull/53000#discussion_r2216822995


##########
airflow-core/tests/unit/utils/test_state.py:
##########
@@ -76,3 +76,39 @@ def test_dagrun_state_enum_escape():
         assert rows[0].state == "queued"
 
         session.rollback()
+
+
+class TestTaskInstanceStates:
+    """Test suite for validating task instance state relationships."""
+
+    def 
test_terminal_and_intermediate_states_union_equals_task_instance_states(self):
+        """Test that union of TerminalTIState and IntermediateTIState values 
equals TaskInstanceState values."""
+        # Get all terminal state values
+        terminal_state_values = {state.value for state in TerminalTIState}
+
+        # Get all intermediate state values
+        intermediate_state_values = {state.value for state in 
IntermediateTIState}
+
+        # Get union of terminal and intermediate states
+        terminal_intermediate_union = 
terminal_state_values.union(intermediate_state_values)
+
+        # Get all TaskInstanceState values, excluding RUNNING since it's not 
in terminal or intermediate
+        task_instance_state_values = {state.value for state in 
TaskInstanceState}
+
+        # Add RUNNING state separately since it's defined directly in 
TaskInstanceState
+        expected_task_instance_values = 
terminal_intermediate_union.union({"running"})
+
+        assert task_instance_state_values == expected_task_instance_values, (
+            f"TaskInstanceState values ({task_instance_state_values}) "
+            f"does not equal union of TerminalTIState and IntermediateTIState 
values plus RUNNING "
+            f"({expected_task_instance_values})"
+        )
+
+    def test_no_overlap_between_failed_and_success_states(self):
+        """Test that failed_states and success_states have no overlap."""
+        overlap = State.failed_states.intersection(State.success_states)
+        assert len(overlap) == 0, f"failed_states and success_states should 
not overlap, but found: {overlap}"
+
+
+if __name__ == "__main__":
+    pytest.main([__file__, "-v"])

Review Comment:
   ? We don't need this!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to