code: def test_constraints():
      cm_ = np.eye(4, 3, k=-1)
      cpairs = np.array(
          [
              [1.0, 0.0, 0.0],
              [0.0, 1.0, 0.0],
              [0.0, 0.0, 1.0],
              [-1.0, 1.0, 0.0],
              [-1.0, 0.0, 1.0],
              [0.0, -1.0, 1.0],
          ]
      )
      c0 = smc._constraints_factor(cm_)
      assert_equal(c0, cpairs)
  
      c1 = smc._contrast_pairs(3, 4, 0)
      assert_equal(c1, cpairs)
  
      # embedded
      cpairs2 = np.array(
          [
              [0.0, 1.0, 0.0, 0.0, 0.0, 0.0],
              [0.0, 0.0, 1.0, 0.0, 0.0, 0.0],
              [0.0, 0.0, 0.0, 1.0, 0.0, 0.0],
              [0.0, -1.0, 1.0, 0.0, 0.0, 0.0],
              [0.0, -1.0, 0.0, 1.0, 0.0, 0.0],
              [0.0, 0.0, -1.0, 1.0, 0.0, 0.0],
          ]
      )
  
      c0 = smc._constraints_factor(cm_, k_params=6, idx_start=1)
      assert_equal(c0, cpairs2)
  
      c1 = smc._contrast_pairs(6, 4, 1)  # k_params, k_level, idx_start
      assert_equal(c1, cpairs2)
  
file_path: statsmodels/statsmodels/stats/tests/test_contrast.py
imports: import numpy
  import numpy.random
  from numpy.testing import assert_almost_equal, assert_equal
  from statsmodels.stats.contrast import Contrast
  import statsmodels.stats.contrast
label_desc: Use image node_id 1 for calling a global function with example usage: test_constraints() without return types