code: def test_pivot_sp(sp, index_type, n_timepoints, anchor_side):
      """Test _pivot_sp contract."""
      df = _make_series(
          n_timepoints=n_timepoints,
          n_columns=1,
          index_type=index_type,
          return_mtype="pd.DataFrame",
      )
  
      df_pivot = _pivot_sp(df, sp, anchor_side=anchor_side)
  
      if index_type != "range":
          assert isinstance(df_pivot.index, type(df.index))
      else:
          pd.api.types.is_integer_dtype(df_pivot.index)
  
      # ensure expected size of the resulting DataFrame
      assert len(df_pivot.columns) == min(sp, len(df))
      assert len(df_pivot) == ceil(len(df) / sp)
  
      # compare values in pivot and plain frame,
      # check these are the same if read in left-right-then-top-down order
      pivot_values = df_pivot.values.flatten()
      pivot_values = pivot_values[~np.isnan(pivot_values)]
      df_values = df.values.flatten()
      assert np.all(df_values == pivot_values)
  
      # if anchor_side is "start", top left should be non-nan and bottom right nan
      # if anchor_side is "end", top left should be nan and bottom right non-nan
      # only if there is more than one timepoint, otherwise the result will be 1-element
      if n_timepoints > 1:
          if anchor_side == "start":
              assert not np.isnan(df_pivot.iloc[0, 0])
              assert np.isnan(df_pivot.iloc[-1, -1])
          else:
              assert np.isnan(df_pivot.iloc[0, 0])
              assert not np.isnan(df_pivot.iloc[-1, -1])
  
file_path: sktime/sktime/utils/tests/test_seasonal.py
imports: from math import ceil
  import numpy
  import pandas
  import pytest
  from sktime.utils._testing.series import _make_series
  from sktime.utils.seasonality import _pivot_sp, _unpivot_sp
label_desc: Use image node_id 1 for calling a global function with example usage: test_pivot_sp(sp, index_type, n_timepoints, anchor_side) without return types