code: def test_nipy_tsdiffana(in_tmp_path):
      # Test nipy_tsdiffana script
      out_png = "ts_out.png"
      # Quotes in case of space in arguments
      for i, extras in enumerate(
          (
              [],
              ["--time-axis=0"],
              ["--slice-axis=0"],
              ["--slice-axis=0", "--time-axis=1"],
          )
      ):
          out_png = f"ts_out{i}.png"
          cmd = (
              ["nipy_tsdiffana", funcfile]
              + extras
              + ["--out-file=" + out_png]
          )
          run_command(cmd)
          assert isfile(out_png)
      # Out-file and write-results incompatible
      cmd = [
          "nipy_tsdiffana",
          funcfile,
          "--out-file=" + out_png,
          "--write-results",
      ]
      pytest.raises(RuntimeError, run_command, cmd)
      # Can save images
      cmd_root = ["nipy_tsdiffana", funcfile]
      os.mkdir("myresults")
      run_command(
          cmd_root + ["--out-path=myresults", "--write-results"]
      )
      assert isfile(pjoin("myresults", "tsdiff_functional.png"))
      assert isfile(pjoin("myresults", "tsdiff_functional.npz"))
      assert isfile(pjoin("myresults", "dv2_max_functional.nii.gz"))
      assert isfile(pjoin("myresults", "dv2_mean_functional.nii.gz"))
      run_command(
          cmd_root
          + [
              "--out-path=myresults",
              "--write-results",
              "--out-fname-label=vr2",
          ]
      )
      assert isfile(pjoin("myresults", "tsdiff_vr2.png"))
      assert isfile(pjoin("myresults", "tsdiff_vr2.npz"))
      assert isfile(pjoin("myresults", "dv2_max_vr2.nii.gz"))
      assert isfile(pjoin("myresults", "dv2_mean_vr2.nii.gz"))
  
file_path: nipy/nipy/tests/test_scripts.py
imports: import os
  from os.path import isfile
  from os.path import join
  from unittest import skipIf
  import numpy
  import pytest
  from nibabel.optpkg import optional_package
  from numpy.testing import assert_almost_equal
  from nipy import load_image, save_image
  from nipy.core.api import rollimg
  from nipy.testing.decorators import make_label_dec
  from ..testing import funcfile
  from .scriptrunner import ScriptRunner
label_desc: Use image node_id 2 for calling a global function with example usage: test_nipy_tsdiffana(in_tmp_path) without return types