code: def test_dot_reduce():
      # Chaining numpy dot
      # Error for no arguments
      with pytest.raises(TypeError):
          dot_reduce()
      # Anything at all on its own, passes through
      assert dot_reduce(1) == 1
      assert dot_reduce(None) is None
      assert dot_reduce([1, 2, 3]) == [1, 2, 3]
      # Two or more -> dot product
      vec = [1, 2, 3]
      mat = np.arange(4, 13).reshape((3, 3))
      assert_array_equal(dot_reduce(vec, mat), np.dot(vec, mat))
      assert_array_equal(dot_reduce(mat, vec), np.dot(mat, vec))
      mat2 = np.arange(13, 22).reshape((3, 3))
      assert_array_equal(dot_reduce(mat2, vec, mat), mat2 @ (vec @ mat))
      assert_array_equal(dot_reduce(mat, vec, mat2), mat @ (vec @ mat2))
  
file_path: nibabel/nibabel/tests/test_affines.py
imports: from itertools import product
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from ..affines import AffineError, append_diag, apply_affine, dot_reduce, from_matvec, obliquity, rescale_affine, to_matvec, voxel_sizes
  from ..eulerangles import euler2mat
  from ..orientations import aff2axcodes
label_desc: Use image node_id 5 for calling a global function with example usage: test_dot_reduce() without return types