code: def test_largest_cc():
      """Check the extraction of the largest connected component."""
      a = np.zeros((6, 6, 6))
      with pytest.raises(ValueError):
          largest_connected_component(a)
      a[1:3, 1:3, 1:3] = 1
      np.testing.assert_equal(a, largest_connected_component(a))
      # A simple test with non-native dtype
      a_change_type = a.astype(">f8")
      np.testing.assert_equal(
          a, largest_connected_component(a_change_type)
      )
  
      b = a.copy()
      b[5, 5, 5] = 1
      np.testing.assert_equal(a, largest_connected_component(b))
      # A simple test with non-native dtype
      b_change_type = b.astype(">f8")
      np.testing.assert_equal(
          a, largest_connected_component(b_change_type)
      )
  
      # Tests for correct errors, when an image or string are passed.
      img = data_gen.generate_labeled_regions(
          shape=(10, 11, 12), n_regions=2
      )
  
      with pytest.raises(ValueError):
          largest_connected_component(img)
      with pytest.raises(ValueError):
          largest_connected_component("Test String")
  
file_path: nilearn/nilearn/_utils/tests/test_ndimage.py
imports: import numpy
  import pytest
  from nilearn._utils import data_gen
  from nilearn._utils.ndimage import largest_connected_component, peak_local_max
label_desc: Use image node_id 1 for calling a global function with example usage: test_largest_cc() without return types