code: def test_asof_locs_mismatched_type(self):
      dti = date_range("2016-01-01", periods=3)
      pi = dti.to_period("D")
      pi2 = dti.to_period("h")
  
      mask = np.array([0, 1, 0], dtype=bool)
  
      msg = "must be DatetimeIndex or PeriodIndex"
      with pytest.raises(TypeError, match=msg):
          pi.asof_locs(pd.Index(pi.asi8, dtype=np.int64), mask)
  
      with pytest.raises(TypeError, match=msg):
          pi.asof_locs(pd.Index(pi.asi8, dtype=np.float64), mask)
  
      with pytest.raises(TypeError, match=msg):
          # TimedeltaIndex
          pi.asof_locs(dti - dti, mask)
  
      msg = "Input has different freq=h"
      with pytest.raises(libperiod.IncompatibleFrequency, match=msg):
          pi.asof_locs(pi2, mask)
  
imports: from datetime import datetime
  import re
  import numpy
  import pytest
  from pandas._libs.tslibs import period
  from pandas.errors import InvalidIndexError
  import pandas
  from pandas import DatetimeIndex, NaT, Period, PeriodIndex, Series, Timedelta, date_range, notna, period_range
  import pandas._testing
label_desc: Use image node_id 1 for calling the TestAsOfLocs obj's underlying member method code with example usage: obj.test_asof_locs_mismatched_type() without return types