code: def test_apply_to_empty_series(index, freq):
      # GH 14313
      ser = Series(index=index)
  
      if freq == "ME" and isinstance(ser.index, TimedeltaIndex):
          msg = (
              "Resampling on a TimedeltaIndex requires fixed-duration `freq`, "
              "e.g. '24h' or '3D', not <MonthEnd>"
          )
          with pytest.raises(ValueError, match=msg):
              ser.resample(freq)
          return
      elif freq == "ME" and isinstance(ser.index, PeriodIndex):
          # index is PeriodIndex, so convert to corresponding Period freq
          freq = "M"
  
      msg = "Resampling with a PeriodIndex"
      warn = None
      if isinstance(ser.index, PeriodIndex):
          warn = FutureWarning
  
      with tm.assert_produces_warning(warn, match=msg):
          rs = ser.resample(freq, group_keys=False)
  
      result = rs.apply(lambda x: 1)
      with tm.assert_produces_warning(warn, match=msg):
          expected = ser.resample(freq).apply("sum")
  
      tm.assert_series_equal(result, expected, check_dtype=False)
  
imports: from datetime import datetime
  import numpy
  import pytest
  from pandas import DataFrame, DatetimeIndex, Index, MultiIndex, NaT, PeriodIndex, Series, TimedeltaIndex
  import pandas._testing
  from pandas.core.groupby.groupby import DataError
  from pandas.core.groupby.grouper import Grouper
  from pandas.core.indexes.datetimes import date_range
  from pandas.core.indexes.period import period_range
  from pandas.core.indexes.timedeltas import timedelta_range
  from pandas.core.resample import _asfreq_compat
label_desc: Use image node_id 12 for calling a global function with example usage: test_apply_to_empty_series(index, freq) without return types