code: def test_equalize_channels():
      """Test equalizing channels and their ordering."""
      # This function only tests the generic functionality of equalize_channels.
      # Additional tests for each instance type are included in the accompanying
      # test suite for each type.
      pytest.raises(
          TypeError,
          equalize_channels,
          ["foo", "bar"],
          match="Instances to be modified must be an instance of",
      )
  
      raw = RawArray(
          [[1.0], [2.0], [3.0], [4.0]],
          create_info(["CH1", "CH2", "CH3", "CH4"], sfreq=1.0),
      )
      epochs = EpochsArray(
          [[[1.0], [2.0], [3.0]]],
          create_info(["CH5", "CH2", "CH1"], sfreq=1.0),
      )
      cov = make_ad_hoc_cov(
          create_info(["CH2", "CH1", "CH8"], sfreq=1.0, ch_types="eeg")
      )
      cov["bads"] = ["CH1"]
      ave = EvokedArray(
          [[1.0], [2.0]], create_info(["CH1", "CH2"], sfreq=1.0)
      )
  
      raw2, epochs2, cov2, ave2 = equalize_channels(
          [raw, epochs, cov, ave], copy=True
      )
  
      # The Raw object was the first in the list, so should have been used as
      # template for the ordering of the channels. No bad channels should have
      # been dropped.
      assert raw2.ch_names == ["CH1", "CH2"]
      assert_array_equal(raw2.get_data(), [[1.0], [2.0]])
      assert epochs2.ch_names == ["CH1", "CH2"]
      assert_array_equal(epochs2.get_data(copy=False), [[[3.0], [2.0]]])
      assert cov2.ch_names == ["CH1", "CH2"]
      assert cov2["bads"] == cov["bads"]
      assert ave2.ch_names == ave.ch_names
      assert_array_equal(ave2.data, ave.data)
  
      # All objects should have been copied, except for the Evoked object which
      # did not have to be touched.
      assert raw is not raw2
      assert epochs is not epochs2
      assert cov is not cov2
      assert ave is ave2
  
      # Test in-place operation
      raw2, epochs2 = equalize_channels([raw, epochs], copy=False)
      assert raw is raw2
      assert epochs is epochs2
  
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 16 for calling a global function with example usage: test_equalize_channels() without return types