code: def test_jsonsink(tmpdir, inputs_attributes):
      tmpdir.chdir()
      js = nio.JSONFileSink(infields=["test"], in_dict={"foo": "var"})
      setattr(js.inputs, "contrasts.alt", "someNestedValue")
      expected_data = {
          "contrasts": {"alt": "someNestedValue"},
          "foo": "var",
      }
      for key, val in inputs_attributes.items():
          setattr(js.inputs, key, val)
          expected_data[key] = val
  
      res = js.run()
      with open(res.outputs.out_file) as f:
          data = simplejson.load(f)
  
      assert data == expected_data
  
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 21 for calling a global function with example usage: test_jsonsink(tmpdir, inputs_attributes) without return types