code: def test_period_index_frequency_invalid_freq(self, freq_depr):
      # GH#9586
      msg = f"Invalid frequency: {freq_depr[1:]}"
  
      with pytest.raises(ValueError, match=msg):
          period_range("2020-01", "2020-05", freq=freq_depr)
      with pytest.raises(ValueError, match=msg):
          PeriodIndex(["2020-01", "2020-05"], freq=freq_depr)
  
imports: import numpy
  import pytest
  from pandas._libs.tslibs.period import IncompatibleFrequency
  from pandas.core.dtypes.dtypes import PeriodDtype
  from pandas import Index, NaT, Period, PeriodIndex, Series, date_range, offsets, period_range
  import pandas._testing
  from pandas.core.arrays import PeriodArray
label_desc: Use image node_id 2 for calling the TestPeriodIndexDisallowedFreqs obj's underlying member method code with example usage: obj.test_period_index_frequency_invalid_freq(freq_depr) without return types