code: def test_bad_inputs(rng):
      # Too few dimensions
      img = np.ones(10)
      labels = np.arange(10)
      with pytest.raises(ValueError):
          random_walker(img, labels)
  
      # Too many dimensions
      img = rng.normal(size=(3, 3, 3, 3, 3))
      labels = np.arange(3**5).reshape(img.shape)
      with pytest.raises(ValueError):
          random_walker(img, labels)
  
      # Spacing incorrect length
      img = rng.normal(size=(10, 10))
      labels = np.zeros((10, 10))
      labels[2, 4] = 2
      labels[6, 8] = 5
      with pytest.raises(ValueError):
          random_walker(img, labels, spacing=(1,))
  
file_path: nilearn/nilearn/_utils/tests/test_segmentation.py
imports: import numpy
  import pytest
  from nilearn._utils.segmentation import random_walker
label_desc: Use image node_id 5 for calling a global function with example usage: test_bad_inputs(rng) without return types