code: def test_blocks():
      on_off = [[1, 2], [3, 4]]
      tval = np.array([0.4, 1.4, 2.4, 3.4])
      b = blocks(on_off)
      lam = lambdify(t, b)
      assert_array_equal(lam(tval), [0, 1, 0, 1])
      b = blocks(on_off, amplitudes=[3, 5])
      lam = lambdify(t, b)
      assert_array_equal(lam(tval), [0, 3, 0, 5])
      # Check what happens with names
      # Default is from step function
      assert not re.match(r"step\d+\(t\)$", str(b)) is None
      # Can pass in another
      b = blocks(on_off, name="funky_chicken")
      assert str(b) == "funky_chicken(t)"
  
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 6 for calling a global function with example usage: test_blocks() without return types