code: def test_guessed_image_type():
      # Test whether we can guess the image type from example files
      with pytest.deprecated_call():
          assert (
              nils.guessed_image_type(
                  pjoin(DATA_PATH, "example4d.nii.gz")
              )
              == Nifti1Image
          )
          assert (
              nils.guessed_image_type(pjoin(DATA_PATH, "nifti1.hdr"))
              == Nifti1Pair
          )
          assert (
              nils.guessed_image_type(
                  pjoin(DATA_PATH, "example_nifti2.nii.gz")
              )
              == Nifti2Image
          )
          assert (
              nils.guessed_image_type(pjoin(DATA_PATH, "nifti2.hdr"))
              == Nifti2Pair
          )
          assert (
              nils.guessed_image_type(pjoin(DATA_PATH, "tiny.mnc"))
              == Minc1Image
          )
          assert (
              nils.guessed_image_type(pjoin(DATA_PATH, "small.mnc"))
              == Minc2Image
          )
          assert (
              nils.guessed_image_type(pjoin(DATA_PATH, "test.mgz"))
              == MGHImage
          )
          assert (
              nils.guessed_image_type(pjoin(DATA_PATH, "analyze.hdr"))
              == Spm2AnalyzeImage
          )
  
imports: import logging
  import pathlib
  import shutil
  from io import BytesIO
  from os.path import dirname
  from os.path import join
  from tempfile import mkdtemp
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..None import AnalyzeImage, MGHImage, Minc1Image, Minc2Image, Nifti1Header, Nifti1Image, Nifti1Pair, Nifti2Image, Nifti2Pair, Spm2AnalyzeImage, Spm99AnalyzeImage, all_image_classes
  from ..None import analyze
  from ..None import loadsave
  from ..None import nifti1
  from ..None import spm2analyze
  from ..None import spm99analyze
  from ..optpkg import optional_package
  from ..spatialimages import SpatialImage
  from ..testing import expires
  from ..tmpdirs import InTemporaryDirectory
  from ..volumeutils import native_code, swapped_code
label_desc: Use image node_id 8 for calling a global function with example usage: test_guessed_image_type() without return types