with dag_maker(session=session, dag_id="test"):
        task = BaseOperator(task_id="task_1")
    dr = DagRun(dag_id="test", run_id="test", run_type=DagRunType.MANUAL)
    ti0 = TI(task=task, run_id=dr.run_id, map_index=0, state=TaskInstanceState.SUCCESS)
    ti1 = TI(task=task, run_id=dr.run_id, map_index=1, state=None)
    ti2 = TI(task=task, run_id=dr.run_id, map_index=2, state=TaskInstanceState.SUCCESS)
    session.add_all((dr, ti0, ti1, ti2))
    session.flush()
    assert dr.schedule_tis((ti1,), session=session) == 1
    session.refresh(ti0)
    session.refresh(ti1)
    session.refresh(ti2)
    assert ti0.state == TaskInstanceState.SUCCESS
    assert ti1.state == TaskInstanceState.SCHEDULED
    assert ti2.state == TaskInstanceState.SUCCESS
def test_mapped_expand_kwargs(dag_maker):
    with dag_maker():
        @task
        def task_0():
            return {"arg1": "a", "arg2": "b"}
        @task
        def task_1(args_0):
            return [args_0, {"arg1": "y"}, {"arg2": "z"}]
        args_0 = task_0()
        args_list = task_1(args_0=args_0)
        MockOperator.partial(task_id="task_2").expand_kwargs(args_list)
        MockOperator.partial(task_id="task_3").expand_kwargs(
            [{"arg1": "a", "arg2": "b"}, {"arg1": "y"}, {"arg2": "z"}],
        )
        MockOperator.partial(task_id="task_4").expand_kwargs([args_0, {"arg1": "y"}, {"arg2": "z"}])