session = settings.Session()
        dag, subdag = self._make_test_subdag(session)
        session.flush()
        subdag.clear(
            start_date=DEFAULT_DATE,
            end_date=DEFAULT_DATE + datetime.timedelta(days=1),
            dag_run_state=dag_run_state,
            include_subdags=True,
            include_parentdag=True,
            session=session,
        )
        dagrun = (
            session.query(
                DagRun,
            )
            .filter(DagRun.dag_id == dag.dag_id)
            .one()
        )
        assert dagrun.state == dag_run_state
    @pytest.mark.parametrize(
        "ti_state_begin, ti_state_end",
        [
            *((state, None) for state in State.task_states if state != TaskInstanceState.RUNNING),
            (TaskInstanceState.RUNNING, TaskInstanceState.RESTARTING),
        ],
    )
    def test_clear_dag(