docstr: Test that the purge_inactive_dag_warnings method deletes inactive dag warnings
docstr_tok: ["Test","that","the","purge_inactive_dag_warnings","method","deletes","inactive","dag","warnings"]
code: def test_purge_inactive_dag_warnings(self, session):
      """
      Test that the purge_inactive_dag_warnings method deletes inactive dag warnings
      """
  
      dags = [
          DagModel(dag_id="dag_1", is_active=False),
          DagModel(dag_id="dag_2", is_active=True),
      ]
      session.add_all(dags)
      session.commit()
  
      dag_warnings = [
          DagWarning("dag_1", "non-existent pool", "non-existent pool"),
          DagWarning("dag_2", "non-existent pool", "non-existent pool"),
      ]
      session.add_all(dag_warnings)
      session.commit()
  
      DagWarning.purge_inactive_dag_warnings(session)
  
      remaining_dag_warnings = session.query(DagWarning).all()
      assert len(remaining_dag_warnings) == 1
      assert remaining_dag_warnings[0].dag_id == "dag_2"
  
file_path: airflow/tests/models/test_dagwarning.py
imports: from __future__ import annotations
  from unittest import mock
  from unittest.mock import MagicMock
  import pytest
  from sqlalchemy.exc import OperationalError
  from airflow.models import DagModel
  from airflow.models.dagwarning import DagWarning
  from tests.test_utils.db import clear_db_dags
label_desc: Use image node_id 2 for calling the TestDagWarning obj's underlying member method code with example usage: obj.test_purge_inactive_dag_warnings(session) without return types