docstr: Ensure heartrate is set correctly after jobs are queried from the DB
docstr_tok: ["Ensure","heartrate","is","set","correctly","after","jobs","are","queried","from","the","DB"]
code: def test_heart_rate_after_fetched_from_db(
      self, job_runner, job_type, job_heartbeat_sec
  ):
      """Ensure heartrate is set correctly after jobs are queried from the DB"""
      with create_session() as session, conf_vars(
          {(job_type.lower(), "job_heartbeat_sec"): job_heartbeat_sec}
      ):
          job = Job()
          job_runner(job=job)
          session.add(job)
          session.flush()
  
          most_recent = most_recent_job(
              job_runner.job_type, session=session
          )
          assert most_recent.heartrate == float(job_heartbeat_sec)
  
          session.rollback()
  
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 6 for calling the TestJob obj's underlying member method code with example usage: obj.test_heart_rate_after_fetched_from_db(job_runner, job_type, job_heartbeat_sec) without return types