"""Test that tasks with specific dates are only created for backfill runs"""
    with DAG("test", start_date=DEFAULT_DATE) as dag:
        EmptyOperator(task_id="without")
        EmptyOperator(task_id="with_start_date", start_date=DEFAULT_DATE + datetime.timedelta(1))
        EmptyOperator(task_id="with_end_date", end_date=DEFAULT_DATE - datetime.timedelta(1))
    dag_run = DagRun(
        dag_id=dag.dag_id,
        run_type=run_type,
        execution_date=DEFAULT_DATE,
        run_id=DagRun.generate_run_id(run_type, DEFAULT_DATE),
    )
    dag_run.dag = dag
    session.add(dag_run)
    session.flush()
    dag_run.verify_integrity(session=session)
    tis = dag_run.task_instances
    assert len(tis) == expected_tis
    Stats_incr.assert_any_call(
        "task_instance_created-EmptyOperator", expected_tis, tags={"dag_id": "test", "run_type": run_type}
    )
    Stats_incr.assert_any_call(
        "task_instance_created",
        expected_tis,
        tags={"dag_id": "test", "run_type": run_type, "task_type": "EmptyOperator"},
    )
@pytest.mark.parametrize("is_noop", [True, False])
def test_expand_mapped_task_instance_at_create(is_noop, dag_maker, session):