code: def test_reorder_channels(preload, proj):
      """Test reordering of channels."""
      raw = read_raw_fif(raw_fname).crop(0, 0.1).del_proj()
      if proj:  # a no-op but should test it
          raw._projector = np.eye(len(raw.ch_names))
      if preload:
          raw.load_data()
      # with .reorder_channels
      if proj and not preload:
          with pytest.raises(RuntimeError, match="load data"):
              raw.copy().reorder_channels(raw.ch_names[::-1])
          return
      raw_new = raw.copy().reorder_channels(raw.ch_names[::-1])
      assert raw_new.ch_names == raw.ch_names[::-1]
      if proj:
          assert_allclose(
              raw_new._projector, raw._projector, atol=1e-12
          )
      else:
          assert raw._projector is None
          assert raw_new._projector is None
      assert_array_equal(raw[:][0], raw_new[:][0][::-1])
      raw_new.reorder_channels(raw_new.ch_names[::-1][1:-1])
      raw.drop_channels(raw.ch_names[:1] + raw.ch_names[-1:])
      assert_array_equal(raw[:][0], raw_new[:][0])
      with pytest.raises(ValueError, match="repeated"):
          raw.reorder_channels(raw.ch_names[:1] + raw.ch_names[:1])
      # and with .pick
      reord = [1, 0] + list(range(2, len(raw.ch_names)))
      rev = np.argsort(reord)
      raw_new = raw.copy().pick(reord)
      assert_array_equal(raw[:][0], raw_new[rev][0])
  
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 1 for calling a global function with example usage: test_reorder_channels(preload, proj) without return types