code: def test_compute_bridged_electrodes():
      """Test computing bridged electrodes."""
      # test I/O
      raw = read_raw_fif(raw_fname).load_data()
      raw.pick(picks="meg")
      with pytest.raises(RuntimeError, match="No EEG channels found"):
          bridged_idx, ed_matrix = compute_bridged_electrodes(raw)
  
      # test output
      epoch_duration = 3
      raw = read_raw_fif(raw_fname).load_data()
      idx0 = raw.ch_names.index("EEG 001")
      idx1 = raw.ch_names.index("EEG 002")
      raw._data[idx1] = raw._data[idx0]
      bridged_idx, ed_matrix = compute_bridged_electrodes(
          raw, epoch_duration=epoch_duration
      )
      assert bridged_idx == [(idx0, idx1)]
      picks = pick_types(raw.info, meg=False, eeg=True)
      assert ed_matrix.shape == (
          raw.times.size // (epoch_duration * raw.info["sfreq"]),
          picks.size,
          picks.size,
      )
      picks = list(picks)
      assert np.all(
          ed_matrix[:, picks.index(idx0), picks.index(idx1)] == 0
      )
      assert np.all(
          np.isnan(ed_matrix[0][np.tril_indices(len(picks), -1)])
      )
  
file_path: mne-python/mne/preprocessing/tests/test_csd.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy import linalg
  from scipy.io import loadmat
  from mne import Epochs, EvokedArray, create_info, find_events, pick_types, read_epochs
  from mne._fiff.constants import FIFF
  from mne.channels import make_dig_montage
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_fif
  from mne.preprocessing import compute_bridged_electrodes, compute_current_source_density
  from mne.utils import object_diff
label_desc: Use image node_id 6 for calling a global function with example usage: test_compute_bridged_electrodes() without return types