code: def test_asof(self):
      index = date_range("2020-01-01", periods=10)
  
      dt = index[0]
      assert index.asof(dt) == dt
      assert isna(index.asof(dt - timedelta(1)))
  
      dt = index[-1]
      assert index.asof(dt + timedelta(1)) == dt
  
      dt = index[0].to_pydatetime()
      assert isinstance(index.asof(dt), Timestamp)
  
imports: from datetime import timedelta
  from pandas import Index, Timestamp, date_range, isna
label_desc: Use image node_id 2 for calling the TestAsOf obj's underlying member method code with example usage: obj.test_asof() without return types