code: def test_fail_and_success():
      executor = BaseExecutor()
  
      date = timezone.utcnow()
      try_number = 1
      success_state = State.SUCCESS
      fail_state = State.FAILED
      key1 = TaskInstanceKey("my_dag1", "my_task1", date, try_number)
      key2 = TaskInstanceKey("my_dag2", "my_task1", date, try_number)
      key3 = TaskInstanceKey("my_dag2", "my_task2", date, try_number)
      executor.fail(key1, fail_state)
      executor.fail(key2, fail_state)
      executor.success(key3, success_state)
  
      assert len(executor.running) == 0
      assert len(executor.get_event_buffer()) == 3
  
imports: from __future__ import annotations
  import logging
  import sys
  from datetime import timedelta
  from unittest import mock
  import pendulum
  import pytest
  import time_machine
  from airflow.callbacks.callback_requests import CallbackRequest
  from airflow.cli.cli_config import DefaultHelpParser, GroupCommand
  from airflow.cli.cli_parser import AirflowHelpFormatter
  from airflow.executors.base_executor import BaseExecutor, RunningRetryAttemptType
  from airflow.models.baseoperator import BaseOperator
  from airflow.models.taskinstance import TaskInstance, TaskInstanceKey
  from airflow.utils import timezone
  from airflow.utils.state import State
label_desc: Use image node_id 11 for calling a global function with example usage: test_fail_and_success() without return types