code: def test_wrap_aggregate(downsampler, gap_handler, series, index_type):
      series = series.copy()
      series.index = construct_index(series, index_type)
      for n in np.random.randint(100, len(series), 6):
          # make sure n is even (required for MinMax downsampler)
          n = n - (n % 2)
          x_agg, y_agg, indices = wrap_aggregate(
              hf_x=series.index,
              hf_y=series.values,
              downsampler=downsampler(),
              gap_handler=gap_handler(),
              n_out=n,
          )
          assert not pd.Series(y_agg).isna().any()
          assert len(x_agg) == len(y_agg) == len(indices)
          assert len(y_agg) <= n + (n % 2)
  
imports: import numpy
  import pandas
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from plotly_resampler.aggregation import LTTB, EveryNthPoint, FuncAggregator, MedDiffGapHandler, MinMaxAggregator, MinMaxLTTB, MinMaxOverlapAggregator, NoGapHandler
  from .utils import construct_index, wrap_aggregate
label_desc: Use image node_id 5 for calling a global function with example usage: test_wrap_aggregate(downsampler, gap_handler, series, index_type) without return types