code: def test_get_event_channel(event_channels):
      """Test creating and obtaining a figure's UI event channel."""
      # At first, no event channels exist
      assert len(event_channels) == 0
  
      # Open a figure and get the event channel. This should create it.
      fig = plt.figure()
      ui_events._get_event_channel(fig)
      assert len(event_channels) == 1
      assert fig in event_channels
  
      # Closing a figure should delete the event channel.
      # During tests, matplotlib does not open an actual window so we need to force the
      # close event.
      fig.canvas.callbacks.process("close_event", None)
      assert len(event_channels) == 0
  
file_path: mne-python/mne/viz/tests/test_ui_events.py
imports: import matplotlib.pyplot
  import pytest
  from mne.datasets import testing
  from mne.viz import ui_events
label_desc: Use image node_id 4 for calling a global function with example usage: test_get_event_channel(event_channels) without return types