code: def test_predictor(make_predictor, freq: str):
      predictor = make_predictor(freq)
      dataset = list(
          generate_random_dataset(
              num_ts=NUM_TS,
              start_time=START_TIME,
              freq=freq,
              min_length=MIN_LENGTH,
              max_length=MAX_LENGTH,
          )
      )
  
      # get forecasts
      forecasts = list(predictor.predict(dataset))
  
      assert len(dataset) == NUM_TS
      assert len(forecasts) == NUM_TS
  
      # check forecasts are as expected
      for data, forecast in zip(dataset, forecasts):
          assert forecast.samples.shape == (1, PREDICTION_LENGTH)
  
          ref = data["target"][
              -SEASON_LENGTH : -SEASON_LENGTH + PREDICTION_LENGTH
          ]
  
          assert forecast.start_date == forecast_start(data)
  
          # specifically for the seasonal naive we can test the supposed result directly
          if isinstance(predictor, SeasonalNaivePredictor):
              assert np.allclose(forecast.samples[0], ref)
  
file_path: gluonts/test/ext/naive_2/test_predictors.py
imports: import tempfile
  from pathlib import Path
  import numpy
  import pandas
  import pytest
  from flaky import flaky
  from gluonts.dataset.artificial import constant_dataset
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.util import forecast_start
  from gluonts.evaluation import Evaluator, backtest_metrics
  from gluonts.ext.naive_2 import Naive2Predictor
  from gluonts.model.predictor import Predictor
  from gluonts.model.seasonal_naive import SeasonalNaivePredictor
  from gluonts.pydantic import PositiveInt
  from gluonts.time_feature import get_seasonality
label_desc: Use image node_id 2 for calling a global function with example usage: test_predictor(make_predictor, freq) without return types