code: def test_test_data():
      assert str(get_test_data()) == str(
          data_path
      )  # Always get the same result
      # Works the same as using __file__ and os.path utilities
      assert str(get_test_data()) == os.path.abspath(
          os.path.join(os.path.dirname(__file__), "..", "tests", "data")
      )
      # Check action of subdir and that existence checks work
      for subdir in ("nicom", "gifti", "externals"):
          assert (
              get_test_data(subdir)
              == data_path.parent.parent / subdir / "tests" / "data"
          )
          assert os.path.exists(get_test_data(subdir))
          assert not os.path.exists(
              get_test_data(subdir, "doesnotexist")
          )
  
      for subdir in ("freesurfer", "doesnotexist"):
          with pytest.raises(ValueError):
              get_test_data(subdir)
  
      assert not os.path.exists(get_test_data(None, "doesnotexist"))
  
      for subdir, fname in [
          ("gifti", "ascii.gii"),
          ("nicom", "0.dcm"),
          ("externals", "example_1.nc"),
          (None, "empty.tck"),
      ]:
          assert os.path.exists(get_test_data(subdir, fname))
  
file_path: nibabel/nibabel/tests/test_testing.py
imports: import os
  import sys
  import warnings
  import numpy
  import pytest
  from ..casting import sctypes
  from ..testing import assert_allclose_safely, assert_re_in, clear_and_catch_warnings, data_path, error_warnings, get_fresh_mod, get_test_data, suppress_warnings
label_desc: Use image node_id 8 for calling a global function with example usage: test_test_data() without return types