code: def test_process_intercept():
      x = np.array([[1, 2], [1, 3], [1, 4]])
      beta = np.array([0, 1])
      intercept = 1
      pred_cols = ["Intercept", "x"]
      # tests all with intercept term
      x_new, beta_new, pred_cols_new = process_intercept(
          x=x, beta=beta, intercept=intercept, pred_cols=pred_cols
      )
      assert np.array_equal(x_new, x)
      assert np.array_equal(beta_new, np.array([1, 1]))
      assert pred_cols_new == pred_cols
      # x does not have intercept term
      x_no_intercept = np.array([[2], [3], [4]])
      x_new, beta_new, pred_cols_new = process_intercept(
          x=x_no_intercept,
          beta=beta,
          intercept=intercept,
          pred_cols=pred_cols,
      )
      assert np.array_equal(x_new, x)
      assert np.array_equal(beta_new, np.array([1, 1]))
      assert pred_cols_new == pred_cols
      # beta does not have intercept term either
      beta_no_intercept = np.array([1])
      x_new, beta_new, pred_cols_new = process_intercept(
          x=x_no_intercept,
          beta=beta_no_intercept,
          intercept=intercept,
          pred_cols=pred_cols,
      )
      assert np.array_equal(x_new, x)
      assert np.array_equal(beta_new, np.array([1, 1]))
      assert pred_cols_new == pred_cols
      # pred_col does not have intercept term
      pred_cols_no_intercept = ["x"]
      x_new, beta_new, pred_cols_new = process_intercept(
          x=x_no_intercept,
          beta=beta_no_intercept,
          intercept=intercept,
          pred_cols=pred_cols_no_intercept,
      )
      assert np.array_equal(x_new, x)
      assert np.array_equal(beta_new, np.array([1, 1]))
      assert pred_cols_new == pred_cols
      # tests error
      x = np.array([[1, 2], [1, 3], [1, 4]])
      beta = np.array([0, 1, 2])
      intercept = 1
      pred_cols = ["Intercept", "x"]
      with pytest.raises(
          ValueError,
          match="The shape of x and beta do not match. "
          f"x has shape \\(3, 2\\) with the intercept column, "
          f"but beta has length 3.",
      ):
          process_intercept(
              x=x, beta=beta, intercept=intercept, pred_cols=pred_cols
          )
      # tests second error
      x = np.array([[1, 2], [1, 3], [1, 4]])
      beta = np.array([0, 1])
      intercept = 1
      pred_cols = ["(Intercept)", "x", "x2"]
      with pytest.raises(
          ValueError,
          match="The length of pred_cols does not match the shape of x. "
          f"x has shape \\(3, 2\\) with the intercept column, "
          f"but pred_cols has length 3.",
      ):
          process_intercept(
              x=x, beta=beta, intercept=intercept, pred_cols=pred_cols
          )
  
file_path: greykite/greykite/tests/algo/common/test_model_summary_utils.py
imports: import numpy
  import pandas
  import pytest
  from sklearn.linear_model import RidgeCV
  from greykite.algo.common.model_summary_utils import Bootstrapper
  from greykite.algo.common.model_summary_utils import format_summary_df
  from greykite.algo.common.model_summary_utils import get_info_dict_lm
  from greykite.algo.common.model_summary_utils import print_summary
  from greykite.algo.common.model_summary_utils import process_intercept
  from greykite.algo.common.model_summary_utils import round_numbers
label_desc: Use image node_id 1 for calling a global function with example usage: test_process_intercept() without return types