code: def test_custom_events():
      class CustomEvents(EventEnum):
          TEST_EVENT = "test_event"
  
      # Dummy engine
      engine = Engine(lambda engine, batch: 0)
      engine.register_events(*CustomEvents)
      engine.register_events("a", "b", "c")
  
      evs = [CustomEvents.TEST_EVENT, "a", "b", "c"]
  
      # Handle is never called
      handlers = [(e, MagicMock()) for e in evs]
      for e, h in handlers:
          engine.add_event_handler(e, h)
      engine.run(range(1))
      for _, h in handlers:
          assert not h.called
  
      # Advanced engine
      def process_func(engine, batch):
          for e, _ in handlers:
              engine.fire_event(e)
  
      engine = Engine(process_func)
      engine.register_events(*CustomEvents)
      engine.register_events("a", "b", "c")
  
      # Handle should be called
      handlers = [(e, MagicMock()) for e in evs]
      for e, h in handlers:
          engine.add_event_handler(e, h)
      engine.run(range(1))
      for _, h in handlers:
          assert h.called
  
imports: from enum import Enum
  from unittest.mock import MagicMock
  import pytest
  import torch
  import ignite.distributed
  from ignite.engine import Engine, Events
  from ignite.engine.events import CallableEventWithFilter, EventEnum, EventsList
label_desc: Use image node_id 1 for calling a global function with example usage: test_custom_events() without return types