code: def test_apply_roll_with_offset_gap(
      window_length, gap, window_series_pd
  ):
      def max_wrapper(sub_s):
          return apply_roll_with_offset_gap(
              sub_s, gap, max, min_periods=1
          )
  
      rolling_max_obj = roll_series_with_gap(
          window_series_pd,
          window_length,
          gap=gap,
          min_periods=1,
      )
      rolling_max_series = rolling_max_obj.apply(max_wrapper)
  
      def min_wrapper(sub_s):
          return apply_roll_with_offset_gap(
              sub_s, gap, min, min_periods=1
          )
  
      rolling_min_obj = roll_series_with_gap(
          window_series_pd,
          window_length,
          gap=gap,
          min_periods=1,
      )
      rolling_min_series = rolling_min_obj.apply(min_wrapper)
  
      assert len(rolling_max_series) == len(window_series_pd)
      assert len(rolling_min_series) == len(window_series_pd)
  
      gap_num = get_number_from_offset(gap)
      window_length_num = get_number_from_offset(window_length)
      for i in range(len(window_series_pd)):
          start_idx = i - gap_num - window_length_num + 1
          # Now that we have the _apply call, this acts as expected
          end_idx = i - gap_num
  
          # If start and end are negative, they're entirely before
          if start_idx < 0 and end_idx < 0:
              assert pd.isnull(rolling_max_series.iloc[i])
              assert pd.isnull(rolling_min_series.iloc[i])
              continue
  
          if start_idx < 0:
              start_idx = 0
  
          # Because the row values are a range from 0 to 20, the rolling min will be the start index
          # and the rolling max will be the end idx
          assert rolling_min_series.iloc[i] == start_idx
          assert rolling_max_series.iloc[i] == end_idx
  
imports: from unittest.mock import patch
  import numpy
  import pandas
  import pytest
  from featuretools.primitives import RollingCount, RollingMax, RollingMean, RollingMin, RollingSTD, RollingTrend
  from featuretools.primitives.standard.transform.time_series.utils import _get_rolled_series_without_gap, apply_roll_with_offset_gap, roll_series_with_gap
  from featuretools.tests.primitive_tests.utils import get_number_from_offset
label_desc: Use image node_id 10 for calling a global function with example usage: test_apply_roll_with_offset_gap(window_length, gap, window_series_pd) and returns: apply_roll_with_offset_gap, apply_roll_with_offset_gap