code: def test_find_ch_adjacency():
      """Test computing the adjacency matrix."""
      raw = read_raw_fif(raw_fname)
      sizes = {"mag": 828, "grad": 1700, "eeg": 384}
      nchans = {"mag": 102, "grad": 204, "eeg": 60}
      for ch_type in ["mag", "grad", "eeg"]:
          conn, ch_names = find_ch_adjacency(raw.info, ch_type)
          # Silly test for checking the number of neighbors.
          assert_equal(conn.getnnz(), sizes[ch_type])
          assert_equal(len(ch_names), nchans[ch_type])
          kwargs = dict(exclude=())
          if ch_type in ("mag", "grad"):
              kwargs["meg"] = ch_type
          else:
              kwargs[ch_type] = True
          want_names = [
              raw.ch_names[pick]
              for pick in pick_types(raw.info, **kwargs)
          ]
          assert ch_names == want_names
      pytest.raises(ValueError, find_ch_adjacency, raw.info, None)
  
      # Test computing the conn matrix with gradiometers.
      conn, ch_names = _compute_ch_adjacency(raw.info, "grad")
      assert_equal(conn.getnnz(), 2680)
  
      # Test ch_type=None.
      raw.pick(picks="mag")
      find_ch_adjacency(raw.info, None)
  
      bti_fname = testing_path / "BTi" / "erm_HFH" / "c,rfDC"
      bti_config_name = testing_path / "BTi" / "erm_HFH" / "config"
      raw = read_raw_bti(bti_fname, bti_config_name, None)
      _, ch_names = find_ch_adjacency(raw.info, "mag")
      assert "A1" in ch_names
  
      ctf_fname = testing_path / "CTF" / "testdata_ctf_short.ds"
      raw = read_raw_ctf(ctf_fname)
      _, ch_names = find_ch_adjacency(raw.info, "mag")
      assert "MLC11" in ch_names
  
      pytest.raises(ValueError, find_ch_adjacency, raw.info, "eog")
  
      raw_kit = read_raw_kit(fname_kit_157)
      neighb, ch_names = find_ch_adjacency(raw_kit.info, "mag")
      assert neighb.data.size == 1329
      assert ch_names[0] == "MEG 001"
  
imports: import hashlib
  from copy import deepcopy
  from functools import partial
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from scipy.io import savemat
  from mne import Epochs, EpochsArray, EvokedArray, create_info, make_ad_hoc_cov, pick_channels, pick_types, read_events
  from mne._fiff.constants import FIFF, _ch_unit_mul_named
  from mne.channels import combine_channels, equalize_channels, find_ch_adjacency, get_builtin_ch_adjacencies, make_1020_channel_selections, read_ch_adjacency, read_custom_montage, rename_channels
  from mne.channels.channels import _BUILTIN_CHANNEL_ADJACENCIES, _BuiltinChannelAdjacency, _ch_neighbor_adjacency, _compute_ch_adjacency
  from mne.datasets import testing
  from mne.io import RawArray, read_info, read_raw_bti, read_raw_ctf, read_raw_eeglab, read_raw_fif, read_raw_kit
  from mne.parallel import parallel_func
  from mne.utils import requires_good_network
label_desc: Use image node_id 11 for calling a global function with example usage: test_find_ch_adjacency() without return types