code: def test_pick_channels_cov():
      """Test picking channels from a Covariance object."""
      info = create_info(["CH1", "CH2", "CH3"], 1.0, ch_types="eeg")
      cov = make_ad_hoc_cov(info)
      cov["data"] = np.array([1.0, 2.0, 3.0])
  
      cov_copy = pick_channels_cov(
          cov, ["CH2", "CH1"], ordered=False, copy=True
      )
      assert cov_copy.ch_names == ["CH1", "CH2"]
      assert_array_equal(cov_copy["data"], [1.0, 2.0])
  
      # Test re-ordering channels
      cov_copy = pick_channels_cov(
          cov, ["CH2", "CH1"], ordered=True, copy=True
      )
      assert cov_copy.ch_names == ["CH2", "CH1"]
      assert_array_equal(cov_copy["data"], [2.0, 1.0])
  
      # Test picking in-place
      pick_channels_cov(cov, ["CH2", "CH1"], copy=False, ordered=False)
      assert cov.ch_names == ["CH1", "CH2"]
      assert_array_equal(cov["data"], [1.0, 2.0])
  
      # Test whether `method` and `loglik` are dropped when None
      cov["method"] = None
      cov["loglik"] = None
      cov_copy = pick_channels_cov(cov, ["CH1", "CH2"], copy=True)
      assert "method" not in cov_copy
      assert "loglik" not in cov_copy
  
imports: from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from mne import Epochs, channel_indices_by_type, channel_type, create_info, make_ad_hoc_cov, pick_channels, pick_channels_cov, pick_channels_regexp, pick_info, pick_types, pick_types_forward, read_forward_solution, rename_channels
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT, _contains_ch_type, _picks_by_type, _picks_to_idx, get_channel_type_constants
  from mne.channels import make_standard_montage
  from mne.datasets import testing
  from mne.io import RawArray, read_info, read_raw_bti, read_raw_fif, read_raw_kit
  from mne.preprocessing import compute_current_source_density
  from mne.utils import assert_object_equal, catch_logging
label_desc: Use image node_id 19 for calling a global function with example usage: test_pick_channels_cov() without return types