code: def test_group_sparse_covariance_errors(rng):
      signals, _, _ = generate_group_sparse_gaussian_graphs(
          density=0.1,
          n_subjects=5,
          n_features=10,
          min_n_samples=100,
          max_n_samples=151,
          random_state=rng,
      )
  
      alpha = 0.1
  
      # Test input argument checking
      with pytest.raises(ValueError, match="must be a positive number"):
          group_sparse_covariance(signals, "")
      with pytest.raises(
          ValueError, match="subjects' .* must be .* iterable"
      ):
          group_sparse_covariance(1, alpha)
      with pytest.raises(
          ValueError,
          match="All subjects must have the same number of features.",
      ):
          group_sparse_covariance(
              [np.ones((2, 2)), np.ones((2, 3))], alpha
          )
  
file_path: nilearn/nilearn/connectome/tests/test_group_sparse_cov.py
imports: import numpy
  import pytest
  from nilearn._utils.data_gen import generate_group_sparse_gaussian_graphs
  from nilearn.connectome import GroupSparseCovariance, GroupSparseCovarianceCV
  from nilearn.connectome.group_sparse_cov import group_sparse_covariance, group_sparse_scores
label_desc: Use image node_id 4 for calling a global function with example usage: test_group_sparse_covariance_errors(rng) without return types