code: def test_datasets_basic(tmp_path, monkeypatch):
      """Test simple dataset functions."""
      # XXX 'hf_sef' and 'misc' do not conform to these standards
      for dname in (
          "sample",
          "somato",
          "spm_face",
          "testing",
          "opm",
          "bst_raw",
          "bst_auditory",
          "bst_resting",
          "multimodal",
          "bst_phantom_ctf",
          "bst_phantom_elekta",
          "kiloword",
          "mtrf",
          "phantom_4dbti",
          "visual_92_categories",
          "fieldtrip_cmc",
      ):
          if dname.startswith("bst"):
              dataset = getattr(datasets.brainstorm, dname)
          else:
              dataset = getattr(datasets, dname)
          if str(dataset.data_path(download=False)) != ".":
              assert isinstance(dataset.get_version(), str)
              assert datasets.has_dataset(dname)
          else:
              assert dataset.get_version() is None
              assert not datasets.has_dataset(dname)
          print(f"{dname}: {datasets.has_dataset(dname)}")
      tempdir = str(tmp_path)
      # Explicitly test one that isn't preset (given the config)
      monkeypatch.setenv("MNE_DATASETS_SAMPLE_PATH", tempdir)
      dataset = datasets.sample
      assert str(dataset.data_path(download=False)) == "."
      assert dataset.get_version() != ""
      assert dataset.get_version() is None
      # don't let it read from the config file to get the directory,
      # force it to look for the default
      monkeypatch.setenv("_MNE_FAKE_HOME_DIR", tempdir)
      monkeypatch.delenv("SUBJECTS_DIR", raising=False)
      assert str(
          datasets.utils._get_path(None, "foo", "bar")
      ) == op.join(tempdir, "mne_data")
      assert get_subjects_dir(None) is None
      _set_montage_coreg_path()
      sd = get_subjects_dir()
      assert sd.name.endswith("MNE-fsaverage-data")
      monkeypatch.setenv("MNE_DATA", str(tmp_path / "foo"))
      with pytest.raises(
          FileNotFoundError, match="as specified by MNE_DAT"
      ):
          testing.data_path(download=False)
  
imports: import os
  import re
  import shutil
  import zipfile
  from functools import partial
  from os import path
  import pooch
  import pytest
  from mne import datasets, read_labels_from_annot, write_labels_to_annot
  from mne.datasets import fetch_dataset, fetch_infant_template, fetch_phantom, testing
  from mne.datasets._fsaverage.base import _set_montage_coreg_path
  from mne.datasets._infant import base
  from mne.datasets._phantom import base
  from mne.datasets.utils import _manifest_check_download
  from mne.utils import ArgvSetter, _pl, catch_logging, get_subjects_dir, hashfunc, requires_good_network, use_log_level
label_desc: Use image node_id 1 for calling a global function with example usage: test_datasets_basic(tmp_path, monkeypatch) without return types