code: def test_uncompress():
      # for each kind of compression, we create:
      # - a temporary directory (dtemp)
      # - a compressed object (ztemp)
      # - a temporary file-like object to compress into ztemp
      # we then uncompress the ztemp object into dtemp under the name ftemp
      # and check if ftemp exists
      dtemp = mkdtemp()
      ztemp = os.path.join(dtemp, "test.zip")
      ftemp = "test"
      try:
          with contextlib.closing(
              zipfile.ZipFile(ztemp, "w")
          ) as testzip:
              testzip.writestr(ftemp, " ")
          _utils.uncompress_file(ztemp, verbose=0)
  
          assert os.path.exists(os.path.join(dtemp, ftemp))
  
          shutil.rmtree(dtemp)
  
          dtemp = mkdtemp()
          ztemp = os.path.join(dtemp, "test.tar")
  
          # Create dummy file in the dtemp folder, so that the finally statement
          # can easily remove it
          fd, temp = mkstemp(dir=dtemp)
          os.close(fd)
          with contextlib.closing(tarfile.open(ztemp, "w")) as tar:
              tar.add(temp, arcname=ftemp)
          _utils.uncompress_file(ztemp, verbose=0)
  
          assert os.path.exists(os.path.join(dtemp, ftemp))
  
          shutil.rmtree(dtemp)
  
          dtemp = mkdtemp()
          ztemp = os.path.join(dtemp, "test.gz")
          gzip.open(ztemp, "wb").close()
          _utils.uncompress_file(ztemp, verbose=0)
  
          # test.gz gets uncompressed into test
          assert os.path.exists(os.path.join(dtemp, "test"))
  
          shutil.rmtree(dtemp)
  
      finally:
          # all temp files are created into dtemp except temp
          if os.path.exists(dtemp):
              shutil.rmtree(dtemp)
  
imports: import contextlib
  import gzip
  import os
  import shutil
  import tarfile
  import urllib
  import zipfile
  from tempfile import mkdtemp, mkstemp
  from unittest.mock import MagicMock
  import numpy
  import pytest
  import requests
  from nilearn.datasets import _utils
  from nilearn.datasets import utils
label_desc: Use image node_id 12 for calling a global function with example usage: test_uncompress() without return types