code: def test_itersource_join_source_node(tmpdir):
      """Test join on an input node which has an ``itersource``."""
      tmpdir.chdir()
  
      # Make the workflow.
      wf = pe.Workflow(name="test")
      # the iterated input node
      inputspec = pe.Node(
          IdentityInterface(fields=["n"]), name="inputspec"
      )
      inputspec.iterables = [("n", [1, 2])]
      # an intermediate node in the first iteration path
      pre_join1 = pe.Node(IncrementInterface(), name="pre_join1")
      wf.connect(inputspec, "n", pre_join1, "input1")
      # an iterable pre-join node with an itersource
      pre_join2 = pe.Node(ProductInterface(), name="pre_join2")
      pre_join2.itersource = ("inputspec", "n")
      pre_join2.iterables = ("input1", {1: [3, 4], 2: [5, 6]})
      wf.connect(pre_join1, "output1", pre_join2, "input2")
      # an intermediate node in the second iteration path
      pre_join3 = pe.Node(IncrementInterface(), name="pre_join3")
      wf.connect(pre_join2, "output1", pre_join3, "input1")
      # the join node
      join = pe.JoinNode(
          IdentityInterface(fields=["vector"]),
          joinsource="pre_join2",
          joinfield="vector",
          name="join",
      )
      wf.connect(pre_join3, "output1", join, "vector")
      # a join successor node
      post_join1 = pe.Node(SumInterface(), name="post_join1")
      wf.connect(join, "vector", post_join1, "input1")
  
      result = wf.run()
  
      # the expanded graph contains
      # 1 pre_join1 replicate for each inputspec iteration,
      # 2 pre_join2 replicates for each inputspec iteration,
      # 1 pre_join3 for each pre_join2 iteration,
      # 1 join replicate for each inputspec iteration and
      # 1 post_join1 replicate for each join replicate =
      # 2 + (2 * 2) + 4 + 2 + 2 = 14 expansion graph nodes.
      # Nipype factors away the iterable input
      # IdentityInterface but keeps the join IdentityInterface.
      assert (
          len(result.nodes()) == 14
      ), "The number of expanded nodes is incorrect."
      # The first join inputs are:
      # 1 + (3 * 2) and 1 + (4 * 2)
      # The second join inputs are:
      # 1 + (5 * 3) and 1 + (6 * 3)
      # the post-join nodes execution order is indeterminate;
      # therefore, compare the lists item-wise.
      assert [16, 19] in _sum_operands, (
          "The join Sum input is incorrect: %s." % _sum_operands
      )
      assert [7, 9] in _sum_operands, (
          "The join Sum input is incorrect: %s." % _sum_operands
      )
  
imports: import pytest
  from ....None import config
  from ...None import engine
  from ....interfaces import base
  from ....interfaces.utility import IdentityInterface, Function, Merge
  from ....interfaces.base import traits, File
label_desc: Use image node_id 9 for calling a global function with example usage: test_itersource_join_source_node(tmpdir) without return types