code: def test_mixed_freq_raises(self):
      # Mixed freq should fail
      msg = "Period with BDay freq is deprecated"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          end_intv = Period("2005-05-01", "B")
  
      vals = [end_intv, Period("2006-12-31", "w")]
      msg = r"Input has different freq=W-SUN from PeriodIndex\(freq=B\)"
      depr_msg = r"PeriodDtype\[B\] is deprecated"
      with pytest.raises(IncompatibleFrequency, match=msg):
          with tm.assert_produces_warning(
              FutureWarning, match=depr_msg
          ):
              PeriodIndex(vals)
      vals = np.array(vals)
      with pytest.raises(IncompatibleFrequency, match=msg):
          with tm.assert_produces_warning(
              FutureWarning, match=depr_msg
          ):
              PeriodIndex(vals)
  
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 29 for calling the TestPeriodIndex obj's underlying member method code with example usage: obj.test_mixed_freq_raises() without return types