code: def test_nested_workflow_join(tmpdir):
      """Test collecting join inputs within a nested workflow"""
      tmpdir.chdir()
  
      # Make the nested workflow
      def nested_wf(i, name="smallwf"):
          # iterables with list of nums
          inputspec = pe.Node(
              IdentityInterface(fields=["n"]), name="inputspec"
          )
          inputspec.iterables = [("n", i)]
          # increment each iterable before joining
          pre_join = pe.Node(IncrementInterface(), name="pre_join")
          # rejoin nums into list
          join = pe.JoinNode(
              IdentityInterface(fields=["n"]),
              joinsource="inputspec",
              joinfield="n",
              name="join",
          )
          # define and connect nested workflow
          wf = pe.Workflow(name="wf_%d" % i[0])
          wf.connect(inputspec, "n", pre_join, "input1")
          wf.connect(pre_join, "output1", join, "n")
          return wf
  
      # master wf
      meta_wf = pe.Workflow(name="meta", base_dir=".")
      # add each mini-workflow to master
      for i in [[1, 3], [2, 4]]:
          mini_wf = nested_wf(i)
          meta_wf.add_nodes([mini_wf])
  
      result = meta_wf.run()
  
      # there should be six nodes in total
      assert (
          len(result.nodes()) == 6
      ), "The number of expanded nodes is incorrect."
  
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 12 for calling a global function with example usage: test_nested_workflow_join(tmpdir) and returns: wf