code: def test_periodindex(self):
      # array or list or dates
      N = 50
      rng = period_range("1/1/1990", periods=N, freq="h")
      ts = Series(
          np.random.default_rng(2).standard_normal(N), index=rng
      )
      ts.iloc[15:30] = np.nan
      dates = date_range("1/1/1990", periods=N * 3, freq="37min")
  
      result = ts.asof(dates)
      assert notna(result).all()
      lb = ts.index[14]
      ub = ts.index[30]
  
      result = ts.asof(list(dates))
      assert notna(result).all()
      lb = ts.index[14]
      ub = ts.index[30]
  
      pix = PeriodIndex(result.index.values, freq="h")
      mask = (pix >= lb) & (pix < ub)
      rs = result[mask]
      assert (rs == ts[lb]).all()
  
      ts.iloc[5:10] = np.nan
      ts.iloc[15:20] = np.nan
  
      val1 = ts.asof(ts.index[7])
      val2 = ts.asof(ts.index[19])
  
      assert val1 == ts.iloc[4]
      assert val2 == ts.iloc[14]
  
      # accepts strings
      val1 = ts.asof(str(ts.index[7]))
      assert val1 == ts.iloc[4]
  
      # in there
      assert ts.asof(ts.index[3]) == ts.iloc[3]
  
      # no as of value
      d = ts.index[0].to_timestamp() - offsets.BDay()
      assert isna(ts.asof(d))
  
      # Mismatched freq
      msg = "Input has different freq"
      with pytest.raises(IncompatibleFrequency, match=msg):
          ts.asof(rng.asfreq("D"))
  
file_path: pandas/pandas/tests/series/methods/test_asof.py
imports: import numpy
  import pytest
  from pandas._libs.tslibs import IncompatibleFrequency
  from pandas import DatetimeIndex, PeriodIndex, Series, Timestamp, date_range, isna, notna, offsets, period_range
  import pandas._testing
label_desc: Use image node_id 5 for calling the TestSeriesAsof obj's underlying member method code with example usage: obj.test_periodindex() without return types