code: def test_gridsearch_random_search(self):
      np.random.seed(1)
  
      dummy_series = get_dummy_series(ts_length=50)
  
      param_range = list(range(10, 20))
      params = {"lags": param_range}
  
      model = RandomForest(lags=1)
      result = model.gridsearch(
          params, dummy_series, forecast_horizon=1, n_random_samples=5
      )
  
      assert isinstance(result[0], RandomForest)
      assert isinstance(result[1]["lags"], int)
      assert isinstance(result[2], float)
      assert min(param_range) <= result[1]["lags"] <= max(param_range)
  
imports: import random
  from itertools import product
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.datasets import AirPassengersDataset, MonthlyMilkDataset
  from darts.logging import get_logger
  from darts.metrics import mape, r2_score
  from darts.models import ARIMA, FFT, ExponentialSmoothing, NaiveDrift, NaiveSeasonal, Theta
  from darts.tests.conftest import tfm_kwargs
  from darts.utils.timeseries_generation import gaussian_timeseries
  from darts.utils.timeseries_generation import linear_timeseries
  from darts.utils.timeseries_generation import random_walk_timeseries
  from darts.utils.timeseries_generation import sine_timeseries
label_desc: Use image node_id 7 for calling the TestBacktesting obj's underlying member method code with example usage: obj.test_gridsearch_random_search() without return types