code: def test_event_colors():
      """Test color assignment."""
      events = pick_events(_get_events(), include=[1, 2])
      unique_events = set(events[:, 2])
      # make sure defaults work
      colors = _handle_event_colors(None, unique_events, dict())
      default_colors = _get_color_list()
      assert colors[1] == default_colors[0]
      # make sure custom color overrides default
      colors = _handle_event_colors(
          color_dict=dict(foo="k", bar="#facade"),
          unique_events=unique_events,
          event_id=dict(foo=1, bar=2),
      )
      assert colors[1] == "k"
      assert colors[2] == "#facade"
  
imports: from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from mne import SourceEstimate, pick_events, read_cov, read_dipole, read_events, read_evokeds, read_source_spaces
  from mne.chpi import compute_chpi_snr
  from mne.datasets import testing
  from mne.filter import create_filter
  from mne.io import read_raw_fif
  from mne.minimum_norm import read_inverse_operator
  from mne.time_frequency import CrossSpectralDensity
  from mne.viz import plot_bem, plot_chpi_snr, plot_csd, plot_events, plot_filter, plot_snr_estimate, plot_source_spectrogram
  from mne.viz.misc import _handle_event_colors
  from mne.viz.utils import _get_color_list
label_desc: Use image node_id 6 for calling a global function with example usage: test_event_colors() without return types