code: def test_bootstrap_against_itself_2samp(method, expected):
      # The expected values in this test were generated using bootstrap
      # to check for unintended changes in behavior. The test also makes sure
      # that bootstrap works with multi-sample statistics and that the
      # `axis` argument works as expected / function is vectorized.
      np.random.seed(0)
  
      n1 = 100  # size of sample 1
      n2 = 120  # size of sample 2
      n_resamples = (
          999  # number of bootstrap resamples used to form each CI
      )
      confidence_level = 0.9
  
      # The statistic we're interested in is the difference in means
      def my_stat(data1, data2, axis=-1):
          mean1 = np.mean(data1, axis=axis)
          mean2 = np.mean(data2, axis=axis)
          return mean1 - mean2
  
      # The true difference in the means is -0.1
      dist1 = stats.norm(loc=0, scale=1)
      dist2 = stats.norm(loc=0.1, scale=1)
      stat_true = dist1.mean() - dist2.mean()
  
      # Do the same thing 1000 times. (The code is fully vectorized.)
      n_replications = 1000
      data1 = dist1.rvs(size=(n_replications, n1))
      data2 = dist2.rvs(size=(n_replications, n2))
      res = bootstrap(
          (data1, data2),
          statistic=my_stat,
          confidence_level=confidence_level,
          n_resamples=n_resamples,
          batch=50,
          method=method,
          axis=-1,
      )
      ci = res.confidence_interval
  
      # ci contains vectors of lower and upper confidence interval bounds
      ci_contains_true = np.sum(
          (ci[0] < stat_true) & (stat_true < ci[1])
      )
      assert ci_contains_true == expected
  
      # ci_contains_true is not inconsistent with confidence_level
      pvalue = stats.binomtest(
          ci_contains_true, n_replications, confidence_level
      ).pvalue
      assert pvalue > 0.1
  
imports: import numpy
  import pytest
  from scipy.stats import bootstrap
  from numpy.testing import assert_allclose, assert_equal
  from scipy import stats
  from scipy.stats import _bootstrap
  from scipy._lib._util import rng_integers
label_desc: Use image node_id 8 for calling a global function with example usage: test_bootstrap_against_itself_2samp(method, expected) and returns: unknown