code: def test_lag_order_selection():
      if debug_mode:
          if "lag order" not in to_test:  # pragma: no cover
              return
          else:
              print("\n\nLAG ORDER SELECTION", end="")
      for ds in datasets:
          for dt in ds.dt_s_list:
              if debug_mode:
                  print("\n" + dt_s_tup_to_string(dt) + ": ", end="")
  
              deterministic = dt[0]
              endog_tot = data[ds]
  
              trend = "n" if dt[0] == "nc" else dt[0]
              obtained_all = select_order(
                  endog_tot, 10, deterministic=dt[0], seasons=dt[1]
              )
              deterministic_outside_exog = ""
              # "co" is not in exog in any test case
              if "co" in deterministic:
                  deterministic_outside_exog += "co"
              # "lo" is is in exog only in test cases with seasons>0
              if "lo" in deterministic and dt[1] == 0:
                  deterministic_outside_exog += "lo"
  
              exog_model = results_sm_exog[ds][dt].exog
              exog = exog_model is not None
              exog_coint_model = results_sm_exog_coint[ds][
                  dt
              ].exog_coint
              exog_coint = exog_coint_model is not None
  
              obtained_all_exog = select_order(
                  endog_tot,
                  10,
                  deterministic_outside_exog,
                  seasons=0,
                  exog=exog_model,
              )
              # "ci" and "li" are always in exog_coint, so pass "n" as det. term
              obtained_all_exog_coint = select_order(
                  endog_tot,
                  10,
                  "n",
                  seasons=dt[1],
                  exog_coint=exog_coint_model,
              )
              for ic in ["aic", "fpe", "hqic", "bic"]:
                  err_msg = build_err_msg(
                      ds, dt, "LAG ORDER SELECTION - " + ic.upper()
                  )
                  obtained = getattr(obtained_all, ic)
                  desired = results_ref[ds][dt]["lagorder"][ic]
                  assert_allclose(
                      obtained, desired, rtol, atol, False, err_msg
                  )
                  if exog:
                      assert_equal(
                          getattr(obtained_all_exog, ic),
                          getattr(obtained_all, ic),
                          "WITH EXOG" + err_msg,
                      )
                  if exog_coint:
                      assert_equal(
                          getattr(obtained_all_exog_coint, ic),
                          getattr(obtained_all, ic),
                          "WITH EXOG_COINT" + err_msg,
                      )
              # call methods to assure they do not raise exceptions
              obtained_all.summary()
              str(obtained_all)
  
imports: import numpy
  from numpy.testing import assert_, assert_allclose, assert_array_equal, assert_raises, assert_raises_regex
  import pytest
  import statsmodels.datasets.interest_inflation.data
  from statsmodels.tools.testing import assert_equal
  from statsmodels.tsa.vector_ar.tests.JMulTi_results.parse_jmulti_vecm_output import dt_s_tup_to_string, load_results_jmulti, sublists
  from statsmodels.tsa.vector_ar.util import seasonal_dummies
  from statsmodels.tsa.vector_ar.var_model import VARProcess
  from statsmodels.tsa.vector_ar.vecm import VECM, select_coint_rank, select_order
label_desc: Use image node_id 20 for calling a global function with example usage: test_lag_order_selection() without return types