code: def test_check(tmp_path):
      """Test checking functions."""
      pytest.raises(ValueError, check_random_state, "foo")
      pytest.raises(TypeError, _check_fname, 1)
      _check_fname(Path("./foo"))
      fname = tmp_path / "foo"
      with open(fname, "wb"):
          pass
      assert fname.is_file()
      _check_fname(fname, overwrite="read", must_exist=True)
      orig_perms = os.stat(fname).st_mode
      os.chmod(fname, 0)
      if not sys.platform.startswith("win"):
          with pytest.raises(PermissionError, match="read permissions"):
              _check_fname(fname, overwrite="read", must_exist=True)
      os.chmod(fname, orig_perms)
      os.remove(fname)
      assert not fname.is_file()
      pytest.raises(
          OSError, check_fname, "foo", "tets-dip.x", (), (".fif",)
      )
      pytest.raises(ValueError, _check_subject, None, None)
      pytest.raises(TypeError, _check_subject, None, 1)
      pytest.raises(TypeError, _check_subject, 1, None)
      # smoke tests for permitted types
      check_random_state(None).choice(1)
      check_random_state(0).choice(1)
      check_random_state(np.random.RandomState(0)).choice(1)
      check_random_state(np.random.default_rng(0)).choice(1)
  
imports: import os
  import sys
  from pathlib import Path
  import numpy
  import pytest
  import mne
  from mne import pick_channels_cov, read_vectorview_selection
  from mne._fiff.pick import _picks_to_idx
  from mne.datasets import testing
  from mne.utils import Bunch, _check_ch_locs, _check_fname, _check_info_inv, _check_option, _check_range, _check_sphere, _check_subject, _on_missing, _path_like, _safe_input, _suggest, _validate_type, catch_logging, check_fname, check_random_state, check_version
label_desc: Use image node_id 1 for calling a global function with example usage: test_check(tmp_path) without return types