code: def get_test_data(
      subdir: ty.Literal["gifti", "nicom", "externals"] | None = None,
      fname: str | None = None,
  ) -> Traversable:
      parts: tuple[str, ...]
      if subdir is None:
          parts = ("tests", "data")
      elif subdir in ("gifti", "nicom", "externals"):
          parts = (subdir, "tests", "data")
      else:
          raise ValueError(f"Unknown test data directory: {subdir}")
  
      if fname is not None:
          parts += (fname,)
  
      return files("nibabel").joinpath(*parts)
  
imports: from __future__ import annotations
  import os
  import re
  import sys
  import typing
  import unittest
  import warnings
  from contextlib import nullcontext
  from itertools import zip_longest
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from .helpers import assert_data_similar, bytesio_filemap, bytesio_round_trip
  from .np_features import memmap_after_ufunc
label_desc: Use image node_id 1 for calling a global function with example usage: get_test_data(subdir, fname) and returns: files