code: def test_plot_instance_components(browser_backend):
      """Test plotting of components as instances of raw and epochs."""
      raw = _get_raw()
      picks = _get_picks(raw)
      ica = ICA(noise_cov=read_cov(cov_fname), n_components=2)
      with pytest.warns(RuntimeWarning, match="projection"):
          ica.fit(raw, picks=picks)
      ica.exclude = [0]
      fig = ica.plot_sources(raw, title="Components")
      keys = (
          "home",
          "home",
          "end",
          "down",
          "up",
          "right",
          "left",
          "-",
          "+",
          "=",
          "d",
          "d",
          "pageup",
          "pagedown",
          "z",
          "z",
          "s",
          "s",
          "b",
      )
      for key in keys:
          fig._fake_keypress(key)
      x = fig.mne.traces[0].get_xdata()[0]
      y = fig.mne.traces[0].get_ydata()[0]
      fig._fake_click((x, y), xform="data")
      fig._click_ch_name(ch_index=0, button=1)
      fig._fake_keypress("escape")
      browser_backend._close_all()
  
      epochs = _get_epochs()
      fig = ica.plot_sources(epochs, title="Components")
      for key in keys:
          fig._fake_keypress(key)
      # Test a click
      x = fig.mne.traces[0].get_xdata()[0]
      y = fig.mne.traces[0].get_ydata()[0]
      fig._fake_click((x, y), xform="data")
      fig._click_ch_name(ch_index=0, button=1)
      fig._fake_keypress("escape")
  
imports: import sys
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from mne import Annotations, Epochs, make_fixed_length_events, pick_types, read_cov, read_events
  from mne.io import read_raw_fif
  from mne.preprocessing import ICA, create_ecg_epochs, create_eog_epochs
  from mne.utils import _record_warnings, catch_logging
  from mne.viz.ica import _create_properties_layout, plot_ica_properties
  from mne.viz.utils import _fake_click, _fake_keypress
label_desc: Use image node_id 11 for calling a global function with example usage: test_plot_instance_components(browser_backend) without return types