code: def test_percentile_range(rng, canica_data):
      """Test that a warning is given when thresholds are stressed."""
      edge_case = rng.integers(low=1, high=10)
  
      # stess thresholding via edge case
      canica = CanICA(
          n_components=edge_case, threshold=float(edge_case)
      )
  
      with pytest.warns(
          UserWarning, match="obtained a critical threshold"
      ):
          canica.fit(canica_data)
  
imports: import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_almost_equal
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.decomposition.canica import CanICA
  from nilearn.image import get_data, iter_img
  from nilearn.maskers import MultiNiftiMasker
label_desc: Use image node_id 8 for calling a global function with example usage: test_percentile_range(rng, canica_data) without return types