code: def test_ttest_equiv(kind, kwargs, sigma, seed):
      """Test t-test equivalence."""
      rng = np.random.RandomState(seed)
  
      def theirs(*a, **kw):
          f = getattr(scipy.stats, "ttest_%s" % (kind,))
          if kind == "1samp":
              func = partial(f, popmean=0, **kwargs)
          else:
              func = partial(f, **kwargs)
          return func(*a, **kw)[0]
  
      ours = partial(
          getattr(mne.stats, "ttest_%s_no_p" % (kind,)),
          sigma=sigma,
          **kwargs,
      )
  
      X = rng.randn(3, 4, 5)
      if kind == "ind":
          X = [
              X,
              rng.randn(30, 4, 5),
          ]  # should differ based on equal_var
          got = ours(*X)
          want = theirs(*X)
      else:
          got = ours(X)
          want = theirs(X)
      if sigma == 0.0:
          assert_allclose(got, want, rtol=1e-7, atol=1e-6)
      else:
          assert not np.allclose(got, want, rtol=1e-7, atol=1e-6)
          # should mostly be similar, but uniformly smaller because we add
          # something to the divisor (var)
          assert_allclose(got, want, rtol=2e-1, atol=1e-2)
          assert_array_less(np.abs(got), np.abs(want))
  
file_path: mne-python/mne/stats/tests/test_parametric.py
imports: from functools import partial
  from itertools import product
  import numpy
  import pytest
  import scipy.stats
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_less
  import mne
  from mne.stats.parametric import _map_effects, f_mway_rm, f_threshold_mway_rm
label_desc: Use image node_id 4 for calling a global function with example usage: test_ttest_equiv(kind, kwargs, sigma, seed) and returns: func