code: def test_is_alive(self):
      job = Job(heartrate=10, state=State.RUNNING)
      assert job.is_alive() is True
  
      job.latest_heartbeat = timezone.utcnow() - datetime.timedelta(
          seconds=20
      )
      assert job.is_alive() is True
  
      job.latest_heartbeat = timezone.utcnow() - datetime.timedelta(
          seconds=21
      )
      assert job.is_alive() is False
  
      # test because .seconds was used before instead of total_seconds
      # internal repr of datetime is (days, seconds)
      job.latest_heartbeat = timezone.utcnow() - datetime.timedelta(
          days=1
      )
      assert job.is_alive() is False
  
      job.state = State.SUCCESS
      job.latest_heartbeat = timezone.utcnow() - datetime.timedelta(
          seconds=10
      )
      assert (
          job.is_alive() is False
      ), "Completed jobs even with recent heartbeat should not be alive"
  
imports: from __future__ import annotations
  import datetime
  import sys
  from unittest.mock import ANY, Mock, patch
  import pytest
  from sqlalchemy.exc import OperationalError
  from airflow.executors.sequential_executor import SequentialExecutor
  from airflow.jobs.job import Job, most_recent_job, perform_heartbeat, run_job
  from airflow.listeners.listener import get_listener_manager
  from airflow.utils import timezone
  from airflow.utils.session import create_session
  from airflow.utils.state import State
  from tests.listeners import lifecycle_listener
  from tests.test_utils.config import conf_vars
  from tests.utils.test_helpers import MockJobRunner, SchedulerJobRunner, TriggererJobRunner
label_desc: Use image node_id 10 for calling the TestJob obj's underlying member method code with example usage: obj.test_is_alive() without return types