code: def test(self):
      x1, x2 = self.x1, self.x2
      cm = self.cm
  
      # tc : test cases
      for tc in [
          ztest_,
          ztest_smaller,
          ztest_larger,
          ztest_mu,
          ztest_smaller_mu,
          ztest_larger_mu,
      ]:
          zstat, pval = ztest(
              x1,
              x2,
              value=tc.null_value,
              alternative=alternatives[tc.alternative],
          )
          assert_allclose(zstat, tc.statistic, rtol=1e-10)
          assert_allclose(pval, tc.p_value, rtol=1e-10, atol=1e-16)
  
          zstat, pval = cm.ztest_ind(
              value=tc.null_value,
              alternative=alternatives[tc.alternative],
          )
          assert_allclose(zstat, tc.statistic, rtol=1e-10)
          assert_allclose(pval, tc.p_value, rtol=1e-10, atol=1e-16)
  
          # overwrite nan in R's confint
          tc_conf_int = tc.conf_int.copy()
          if np.isnan(tc_conf_int[0]):
              tc_conf_int[0] = -np.inf
          if np.isnan(tc_conf_int[1]):
              tc_conf_int[1] = np.inf
  
          # Note: value is shifting our confidence interval in zconfint
          ci = zconfint(
              x1, x2, value=0, alternative=alternatives[tc.alternative]
          )
          assert_allclose(ci, tc_conf_int, rtol=1e-10)
  
          ci = cm.zconfint_diff(
              alternative=alternatives[tc.alternative]
          )
          assert_allclose(ci, tc_conf_int, rtol=1e-10)
  
          ci = zconfint(
              x1,
              x2,
              value=tc.null_value,
              alternative=alternatives[tc.alternative],
          )
          assert_allclose(ci, tc_conf_int - tc.null_value, rtol=1e-10)
  
      # unequal variances
      for tc in [
          ztest_unequal,
          ztest_smaller_unequal,
          ztest_larger_unequal,
      ]:
          zstat, pval = ztest(
              x1,
              x2,
              value=tc.null_value,
              alternative=alternatives[tc.alternative],
              usevar="unequal",
          )
          assert_allclose(zstat, tc.statistic, rtol=1e-10)
          assert_allclose(pval, tc.p_value, rtol=1e-10, atol=1e-16)
  
      # 1 sample test copy-paste
      d1 = self.d1
      for tc in [ztest_mu_1s, ztest_smaller_mu_1s, ztest_larger_mu_1s]:
          zstat, pval = ztest(
              x1,
              value=tc.null_value,
              alternative=alternatives[tc.alternative],
          )
          assert_allclose(zstat, tc.statistic, rtol=1e-10)
          assert_allclose(pval, tc.p_value, rtol=1e-10, atol=1e-16)
  
          zstat, pval = d1.ztest_mean(
              value=tc.null_value,
              alternative=alternatives[tc.alternative],
          )
          assert_allclose(zstat, tc.statistic, rtol=1e-10)
          assert_allclose(pval, tc.p_value, rtol=1e-10, atol=1e-16)
  
          # overwrite nan in R's confint
          tc_conf_int = tc.conf_int.copy()
          if np.isnan(tc_conf_int[0]):
              tc_conf_int[0] = -np.inf
          if np.isnan(tc_conf_int[1]):
              tc_conf_int[1] = np.inf
  
          # Note: value is shifting our confidence interval in zconfint
          ci = zconfint(
              x1, value=0, alternative=alternatives[tc.alternative]
          )
          assert_allclose(ci, tc_conf_int, rtol=1e-10)
  
          ci = d1.zconfint_mean(
              alternative=alternatives[tc.alternative]
          )
          assert_allclose(ci, tc_conf_int, rtol=1e-10)
  
imports: import numpy
  from scipy import stats
  import pandas
  from numpy.testing import assert_, assert_almost_equal, assert_allclose
  from statsmodels.stats.weightstats import DescrStatsW, CompareMeans, ttest_ind, ztest, zconfint
  from statsmodels.tools.testing import Holder
label_desc: Use image node_id 2 for calling the TestZTest obj's underlying member method code with example usage: obj.test() without return types