code: def test_events():
      # test events utility function
      h = Function("hrf")
      evs = events([3, 6, 9])
      assert (
          DiracDelta(-9 + t) + DiracDelta(-6 + t) + DiracDelta(-3 + t)
          == evs
      )
      evs = events([3, 6, 9], f=h)
      assert h(-3 + t) + h(-6 + t) + h(-9 + t) == evs
      # make some beta symbols
      b = [Dummy("b%d" % i) for i in range(3)]
      a = Symbol("a")
      p = b[0] + b[1] * a + b[2] * a**2
      evs = events([3, 6, 9], amplitudes=[2, 1, -1], g=p)
      assert (2 * b[1] + 4 * b[2] + b[0]) * DiracDelta(-3 + t) + (
          -b[1] + b[0] + b[2]
      ) * DiracDelta(-9 + t) + (b[0] + b[1] + b[2]) * DiracDelta(
          -6 + t
      ) == evs
      evs = events([3, 6, 9], amplitudes=[2, 1, -1], g=p, f=h)
      assert (2 * b[1] + 4 * b[2] + b[0]) * h(-3 + t) + (
          -b[1] + b[0] + b[2]
      ) * h(-9 + t) + (b[0] + b[1] + b[2]) * h(-6 + t) == evs
      # test no error for numpy int arrays
      onsets = np.array([30, 70, 100], dtype=np.int64)
      evs = events(onsets, f=hrf.glover)
  
imports: import re
  import numpy
  import pytest
  import sympy
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from sympy import DiracDelta, Dummy, Function, Symbol
  from sympy.utilities.lambdify import implemented_function, lambdify
  from nipy.algorithms.statistics.formula import Term
  from ..None import hrf
  from ..utils import Interp1dNumeric, TimeConvolver, blocks, convolve_functions, define, events, interp, lambdify_t, linear_interp, step_function
label_desc: Use image node_id 2 for calling a global function with example usage: test_events() without return types