code: def test_branch_one(self, dag_maker, branch_task_name):
      @task
      def dummy_f():
          pass
  
      @task
      def task_1():
          pass
  
      @task
      def task_2():
          pass
  
      if (
          branch_task_name == "task_1"
      ):  # Note we manually need to carry the literal value into the venc code :-(
  
          @task.branch_external_python(
              task_id="branching", python=sys.executable
          )
          def branch_operator():
              return "task_1"
  
      else:
  
          @task.branch_external_python(
              task_id="branching", python=sys.executable
          )
          def branch_operator():
              return "task_2"
  
      with dag_maker():
          branchoperator = branch_operator()
          df = dummy_f()
          task_1 = task_1()
          task_2 = task_2()
  
          df.set_downstream(branchoperator)
          branchoperator.set_downstream(task_1)
          branchoperator.set_downstream(task_2)
  
      dr = dag_maker.create_dagrun()
      df.operator.run(
          start_date=dr.execution_date,
          end_date=dr.execution_date,
          ignore_ti_state=True,
      )
      branchoperator.operator.run(
          start_date=dr.execution_date,
          end_date=dr.execution_date,
          ignore_ti_state=True,
      )
      task_1.operator.run(
          start_date=dr.execution_date,
          end_date=dr.execution_date,
          ignore_ti_state=True,
      )
      task_2.operator.run(
          start_date=dr.execution_date,
          end_date=dr.execution_date,
          ignore_ti_state=True,
      )
      tis = dr.get_task_instances()
  
      for ti in tis:
          if ti.task_id == "dummy_f":
              assert ti.state == State.SUCCESS
          if ti.task_id == "branching":
              assert ti.state == State.SUCCESS
  
          if ti.task_id == "task_1" and branch_task_name == "task_1":
              assert ti.state == State.SUCCESS
          elif ti.task_id == "task_1":
              assert ti.state == State.SKIPPED
  
          if ti.task_id == "task_2" and branch_task_name == "task_2":
              assert ti.state == State.SUCCESS
          elif ti.task_id == "task_2":
              assert ti.state == State.SKIPPED
  
imports: from __future__ import annotations
  import sys
  import pytest
  from airflow.decorators import task
  from airflow.utils.state import State
label_desc: Use image node_id 1 for calling the Test_BranchExternalPythonDecoratedOperator obj's underlying member method code with example usage: obj.test_branch_one(dag_maker, branch_task_name) and returns: str, str