code: def test_once_event_filter(
      event_name, event_attr, once, expect_calls
  ):
      data = list(range(100))
  
      engine = Engine(lambda e, b: b)
      num_calls = [0]
      counter = [0]
  
      test_once = [once] if isinstance(once, int) else once
  
      @engine.on(event_name(once=once))
      def assert_once(engine):
          assert getattr(engine.state, event_attr) in test_once
          num_calls[0] += 1
  
      @engine.on(event_name)
      def assert_(engine):
          counter[0] += 1
          assert getattr(engine.state, event_attr) == counter[0]
  
      engine.run(data, max_epochs=10)
      assert num_calls[0] == expect_calls
  
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 16 for calling a global function with example usage: test_once_event_filter(event_name, event_attr, once, expect_calls) without return types