code: def test_raise_if_period_index():
      index = period_range(start="1/1/1990", periods=20, freq="M")
      msg = "Check the `freq` attribute instead of using infer_freq"
  
      with pytest.raises(TypeError, match=msg):
          frequencies.infer_freq(index)
  
imports: from datetime import datetime, timedelta
  import numpy
  import pytest
  from pandas._libs.tslibs.ccalendar import DAYS, MONTHS
  from pandas._libs.tslibs.offsets import _get_offset
  from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
  from pandas.compat import is_platform_windows
  from pandas import DatetimeIndex, Index, RangeIndex, Series, Timestamp, date_range, period_range
  import pandas._testing
  from pandas.core.arrays import DatetimeArray, TimedeltaArray
  from pandas.core.tools.datetimes import to_datetime
  from pandas.tseries import frequencies, offsets
label_desc: Use image node_id 3 for calling a global function with example usage: test_raise_if_period_index() without return types