code: def test_bipolar_combinations():
      """Test bipolar channel generation."""
      ch_names = ["CH" + str(ni + 1) for ni in range(10)]
      info = create_info(
          ch_names=ch_names,
          sfreq=1000.0,
          ch_types=["eeg"] * len(ch_names),
      )
      raw_data = np.random.randn(len(ch_names), 1000)
      raw = RawArray(raw_data, info)
  
      def _check_bipolar(raw_test, ch_a, ch_b):
          picks = [raw_test.ch_names.index(ch_a + "-" + ch_b)]
          get_data_res = raw_test.get_data(picks=picks)[0, :]
          manual_a = raw_data[ch_names.index(ch_a), :]
          manual_b = raw_data[ch_names.index(ch_b), :]
          assert_array_equal(get_data_res, manual_a - manual_b)
  
      # test classic EOG/ECG bipolar reference (only two channels per pair).
      raw_test = set_bipolar_reference(raw, ["CH2"], ["CH1"], copy=True)
      _check_bipolar(raw_test, "CH2", "CH1")
  
      # test all combinations.
      a_channels, b_channels = zip(*itertools.combinations(ch_names, 2))
      a_channels, b_channels = list(a_channels), list(b_channels)
      raw_test = set_bipolar_reference(
          raw, a_channels, b_channels, copy=True
      )
      for ch_a, ch_b in zip(a_channels, b_channels):
          _check_bipolar(raw_test, ch_a, ch_b)
      # check if reference channels have been dropped.
      assert len(raw_test.ch_names) == len(a_channels)
  
      raw_test = set_bipolar_reference(
          raw, a_channels, b_channels, drop_refs=False, copy=True
      )
      # check if reference channels have been kept correctly.
      assert len(raw_test.ch_names) == len(a_channels) + len(ch_names)
      for idx, ch_label in enumerate(ch_names):
          manual_ch = raw_data[np.newaxis, idx]
          assert_array_equal(raw_test.get_data(ch_label), manual_ch)
  
      # test bipolars with a channel in both list (anode & cathode).
      raw_test = set_bipolar_reference(
          raw, ["CH2", "CH1"], ["CH1", "CH2"], copy=True
      )
      _check_bipolar(raw_test, "CH2", "CH1")
      _check_bipolar(raw_test, "CH1", "CH2")
  
      # test if bipolar channel is bad if anode is a bad channel
      raw.info["bads"] = ["CH1"]
      raw_test = set_bipolar_reference(
          raw,
          ["CH1"],
          ["CH2"],
          on_bad="ignore",
          ch_name="bad_bipolar",
          copy=True,
      )
      assert raw_test.info["bads"] == ["bad_bipolar"]
  
      # test if bipolar channel is bad if cathode is a bad channel
      raw.info["bads"] = ["CH2"]
      raw_test = set_bipolar_reference(
          raw,
          ["CH1"],
          ["CH2"],
          on_bad="ignore",
          ch_name="bad_bipolar",
          copy=True,
      )
      assert raw_test.info["bads"] == ["bad_bipolar"]
  
imports: import itertools
  from contextlib import nullcontext
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from mne import Epochs, Projection, add_reference_channels, create_info, find_events, make_forward_solution, make_sphere_model, pick_channels, pick_channels_forward, pick_types, read_events, read_evokeds, set_bipolar_reference, set_eeg_reference, setup_volume_source_space
  from mne._fiff.constants import FIFF
  from mne._fiff.proj import _has_eeg_average_ref_proj
  from mne._fiff.reference import _apply_reference
  from mne.datasets import testing
  from mne.epochs import BaseEpochs, make_fixed_length_epochs
  from mne.io import RawArray, read_raw_fif
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 10 for calling a global function with example usage: test_bipolar_combinations() without return types