code: def test_apply_roll_with_offset_gap_min_periods(
      min_periods, window_series_pd
  ):
      window_length = "5d"
      window_length_num = 5
      gap = "3d"
      gap_num = 3
  
      def count_wrapper(sub_s):
          return apply_roll_with_offset_gap(
              sub_s, gap, len, min_periods=min_periods
          )
  
      rolling_count_obj = roll_series_with_gap(
          window_series_pd,
          window_length,
          gap=gap,
          min_periods=min_periods,
      )
      rolling_count_series = rolling_count_obj.apply(count_wrapper)
  
      # gap essentially creates rolling series that have no elements; which should be nan
      # to differentiate from when a window only has null values
      num_empty_aggregates = rolling_count_series.isna().sum()
      num_partial_aggregates = len(
          (rolling_count_series.loc[rolling_count_series != 0]).loc[
              rolling_count_series < window_length_num
          ],
      )
  
      assert num_empty_aggregates == min_periods - 1 + gap_num
      assert num_partial_aggregates == window_length_num - min_periods
  
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 12 for calling a global function with example usage: test_apply_roll_with_offset_gap_min_periods(min_periods, window_series_pd) and returns: apply_roll_with_offset_gap