code: def test_bids_infields_outfields(tmpdir):
      tmpdir.chdir()
      infields = ["infield1", "infield2"]
      outfields = ["outfield1", "outfield2"]
      bg = nio.BIDSDataGrabber(infields=infields)
      for outfield in outfields:
          bg.inputs.output_query[outfield] = {"key": "value"}
  
      for infield in infields:
          assert infield in bg.inputs.traits()
          assert not (isdefined(bg.inputs.get()[infield]))
  
      for outfield in outfields:
          assert outfield in bg._outputs().traits()
  
      # now try without defining outfields
      bg = nio.BIDSDataGrabber()
      for outfield in ["T1w", "bold"]:
          assert outfield in bg._outputs().traits()
  
imports: import os
  import copy
  import simplejson
  import glob
  import os.path
  from subprocess import Popen
  import hashlib
  from collections import namedtuple
  import pytest
  import nipype
  import nipype.interfaces.io
  from nipype.interfaces.base.traits_extension import isdefined
  from nipype.interfaces.base import Undefined, TraitError
  from nipype.utils.filemanip import dist_is_editable
  from subprocess import check_call, CalledProcessError
label_desc: Use image node_id 24 for calling a global function with example usage: test_bids_infields_outfields(tmpdir) without return types