code: def test_scalar(self):
      N = 30
      rng = date_range("1/1/1990", periods=N, freq="53s")
      # Explicit cast to float avoid implicit cast when setting nan
      ts = Series(np.arange(N), index=rng, dtype="float")
      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
      result = ts.asof(ts.index[3])
      assert result == ts.iloc[3]
  
      # no as of value
      d = ts.index[0] - offsets.BDay()
      assert np.isnan(ts.asof(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 3 for calling the TestSeriesAsof obj's underlying member method code with example usage: obj.test_scalar() without return types