code: def test_ktrlite_level_segments(make_daily_data, level_segments):
      train_df, test_df, coef = make_daily_data
  
      ktrlite = KTRLite(
          response_col="response",
          date_col="date",
          level_segments=level_segments,
          estimator="stan-map",
          n_bootstrap_draws=-1,
      )
  
      ktrlite.fit(train_df)
      predict_df = ktrlite.predict(test_df)
  
      expected_columns = ["date", "prediction"]
      expected_shape = (364, len(expected_columns))
      expected_num_parameters = (
          len(ktrlite._model.get_model_param_names()) + 1
      )
  
      assert predict_df.shape == expected_shape
      assert predict_df.columns.tolist() == expected_columns
      assert len(ktrlite._posterior_samples) == expected_num_parameters
      knots_df = ktrlite.get_level_knots()
      levels_df = ktrlite.get_levels()
      assert knots_df.shape[0] in [
          level_segments + 1,
          level_segments + 2,
      ]
      assert (
          levels_df.shape[0]
          == ktrlite.get_training_meta()["num_of_obs"]
      )
  
file_path: orbit/tests/orbit/models/test_ktrlite.py
imports: import pytest
  import numpy
  import pandas
  from orbit.models import KTRLite
  from orbit.diagnostics.metrics import smape
label_desc: Use image node_id 3 for calling a global function with example usage: test_ktrlite_level_segments(make_daily_data, level_segments) without return types