code: def test_plot_evoked_image():
      """Test plot_evoked_image."""
      evoked = _get_epochs().average()
      evoked.plot_image(proj=True, time_unit="ms")
  
      # fail nicely on NaN
      evoked_nan = evoked.copy()
      evoked_nan.data[:, 0] = np.nan
      pytest.raises(ValueError, evoked_nan.plot)
      with np.errstate(invalid="ignore"):
          pytest.raises(ValueError, evoked_nan.plot_image)
          pytest.raises(ValueError, evoked_nan.plot_joint)
  
      # test mask
      evoked.plot_image(
          picks=[1, 2], mask=evoked.data > 0, time_unit="s"
      )
      evoked.plot_image(
          picks=[1, 2],
          mask_cmap=None,
          colorbar=False,
          mask=np.ones(evoked.data.shape).astype(bool),
          time_unit="s",
      )
      with pytest.warns(RuntimeWarning, match="not adding contour"):
          evoked.plot_image(
              picks=[1, 2], mask=None, mask_style="both", time_unit="s"
          )
      with pytest.raises(ValueError, match="must have the same shape"):
          evoked.plot_image(mask=evoked.data[1:, 1:] > 0, time_unit="s")
  
      # plot with bad channels excluded
      evoked.plot_image(
          exclude="bads", cmap="interactive", time_unit="s"
      )
      plt.close("all")
  
      with pytest.raises(ValueError, match="not unique"):
          evoked.plot_image(picks=[0, 0], time_unit="s")  # duplicates
  
      ch_names = evoked.ch_names[3:5]
      picks = [evoked.ch_names.index(ch) for ch in ch_names]
      evoked.plot_image(show_names="all", time_unit="s", picks=picks)
      yticklabels = plt.gca().get_yticklabels()
      for tick_target, tick_observed in zip(ch_names, yticklabels):
          assert tick_target in str(tick_observed)
      evoked.plot_image(show_names=True, time_unit="s")
  
      # test groupby
      evoked.plot_image(
          group_by=dict(sel=sel), axes=dict(sel=plt.axes())
      )
      plt.close("all")
      for group_by, axes in (
          ("something", dict()),
          (dict(), "something"),
      ):
          pytest.raises(
              ValueError,
              evoked.plot_image,
              group_by=group_by,
              axes=axes,
          )
  
      with pytest.raises(ValueError, match="`clim` must be a dict."):
          evoked.plot_image(clim=[-4, 4])
  
imports: from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from matplotlib import gridspec
  from matplotlib.collections import PolyCollection
  from matplotlib.colors import same_color
  from mpl_toolkits.axes_grid1.parasite_axes import HostAxes
  from numpy.testing import assert_allclose
  import mne
  from mne import Epochs, compute_covariance, compute_proj_evoked, make_fixed_length_events, read_cov, read_events
  from mne._fiff.constants import FIFF
  from mne.datasets import testing
  from mne.io import read_raw_fif
  from mne.stats.parametric import _parametric_ci
  from mne.utils import catch_logging
  from mne.viz import plot_compare_evokeds, plot_evoked_white
  from mne.viz.utils import _fake_click, _get_cmap
label_desc: Use image node_id 8 for calling a global function with example usage: test_plot_evoked_image() without return types