code: def test_add_event_handler_raises_with_invalid_signature():
      engine = Engine(MagicMock())
  
      def handler(engine):
          pass
  
      engine.add_event_handler(Events.STARTED, handler)
      engine.add_event_handler(Events.STARTED, handler, 1)
  
      def handler_with_args(engine, a):
          pass
  
      engine.add_event_handler(Events.STARTED, handler_with_args, 1)
      with pytest.raises(ValueError):
          engine.add_event_handler(Events.STARTED, handler_with_args)
  
      def handler_with_kwargs(engine, b=42):
          pass
  
      engine.add_event_handler(Events.STARTED, handler_with_kwargs, b=2)
      with pytest.raises(ValueError):
          engine.add_event_handler(
              Events.STARTED, handler_with_kwargs, c=3
          )
      engine.add_event_handler(
          Events.STARTED, handler_with_kwargs, 1, b=2
      )
  
      def handler_with_args_and_kwargs(engine, a, b=42):
          pass
  
      engine.add_event_handler(
          Events.STARTED, handler_with_args_and_kwargs, 1, b=2
      )
      engine.add_event_handler(
          Events.STARTED, handler_with_args_and_kwargs, 1, 2, b=2
      )
      with pytest.raises(ValueError):
          engine.add_event_handler(
              Events.STARTED, handler_with_args_and_kwargs, 1, b=2, c=3
          )
  
imports: import functools
  import gc
  from unittest.mock import call, create_autospec, MagicMock
  import pytest
  from pytest import raises
  from ignite.engine import Engine, Events, State
  from ignite.engine.events import EventsList
label_desc: Use image node_id 2 for calling a global function with example usage: test_add_event_handler_raises_with_invalid_signature() without return types