code: def test_output_equiv(shape, out_type, adjacency):
      """Test equivalence of output types."""
      rng = np.random.RandomState(0)
      n_subjects = 10
      data = rng.randn(n_subjects, *shape)
      data -= data.mean(axis=0, keepdims=True)
      data[:, 2:4] += 2
      data[:, 6:9] += 2
      want_mask = np.zeros(shape, int)
      want_mask[2:4] = 1
      want_mask[6:9] = 2
      if adjacency is not None:
          assert adjacency == "sparse"
          adjacency = combine_adjacency(*shape)
      clusters = permutation_cluster_1samp_test(
          X=data,
          n_permutations=1,
          adjacency=adjacency,
          out_type=out_type,
      )[1]
      got_mask = np.zeros_like(want_mask)
      for n, clu in enumerate(clusters, 1):
          if out_type == "mask":
              if len(shape) == 1 and adjacency is None:
                  assert isinstance(clu, tuple)
                  assert len(clu) == 1
                  assert isinstance(clu[0], slice)
              else:
                  assert isinstance(clu, np.ndarray)
                  assert clu.dtype == np.dtype(bool)
                  assert clu.shape == shape
              got_mask[clu] = n
          else:
              assert isinstance(clu, tuple)
              for c in clu:
                  assert isinstance(c, np.ndarray)
                  assert c.dtype.kind == "i"
              assert out_type == "indices"
              got_mask[np.ix_(*clu)] = n
      assert_array_equal(got_mask, want_mask)
  
imports: import os
  from functools import partial
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import linalg, sparse, stats
  from mne import MixedSourceEstimate, SourceEstimate, SourceSpaces, VolSourceEstimate
  from mne.stats import combine_adjacency, ttest_ind_no_p
  from mne.stats.cluster_level import f_oneway, permutation_cluster_1samp_test, permutation_cluster_test, spatio_temporal_cluster_1samp_test, spatio_temporal_cluster_test, summarize_clusters_stc, ttest_1samp_no_p
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 16 for calling a global function with example usage: test_output_equiv(shape, out_type, adjacency) without return types