code: def test_ndindex():
      x = list(ndindex(1, 2, 3))
      expected = [ix for ix, e in ndenumerate(np.zeros((1, 2, 3)))]
      assert_array_equal(x, expected)
  
      x = list(ndindex((1, 2, 3)))
      assert_array_equal(x, expected)
  
      # Test use of scalars and tuples
      x = list(ndindex((3,)))
      assert_array_equal(x, list(ndindex(3)))
  
      # Make sure size argument is optional
      x = list(ndindex())
      assert_equal(x, [()])
  
      x = list(ndindex(()))
      assert_equal(x, [()])
  
      # Make sure 0-sized ndindex works correctly
      x = list(ndindex(*[0]))
      assert_equal(x, [])
  
imports: import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, assert_array_equal, assert_almost_equal, assert_array_almost_equal, assert_raises, assert_raises_regex
  from numpy.lib.index_tricks import mgrid, ogrid, ndenumerate, fill_diagonal, diag_indices, diag_indices_from, index_exp, ndindex, r_, s_, ix_
label_desc: Use image node_id 3 for calling a global function with example usage: test_ndindex() without return types