code: def test_fail__check_failed(soft_fail, expected_exception):
      current_state = "FAILED"
      target_state = "SUCCESS"
      failure_states = ["FAILED"]
      message = f"Terminal state reached. Current state: {current_state}, Expected state: {target_state}"
      with pytest.raises(expected_exception, match=message):
          _check_failed(
              current_state=current_state,
              target_state=target_state,
              failure_states=failure_states,
              soft_fail=soft_fail,
          )
  
imports: from __future__ import annotations
  from typing import TypeVar
  from unittest import mock
  import boto3
  import pytest
  from slugify import slugify
  from airflow.exceptions import AirflowException, AirflowSkipException
  from airflow.providers.amazon.aws.sensors.ecs import EcsBaseSensor, EcsClusterStates, EcsClusterStateSensor, EcsHook, EcsTaskDefinitionStates, EcsTaskDefinitionStateSensor, EcsTaskStates, EcsTaskStateSensor, _check_failed
  from airflow.utils import timezone
  from airflow.utils.types import NOTSET
label_desc: Use image node_id 1 for calling a global function with example usage: test_fail__check_failed(soft_fail, expected_exception) without return types