code: def test_reporting_iir(phase, ftype, btype, order, output):
      """Test IIR filter reporting."""
      fs = 1000.0
      l_freq = 1.0 if btype == "bandpass" else None
      iir_params = dict(ftype=ftype, order=order, output=output)
      rs = 20 if order == 1 else 80
      if ftype == "ellip":
          iir_params["rp"] = 3  # dB
          iir_params["rs"] = rs  # attenuation
          pass_tol = np.log10(iir_params["rp"]) + 0.01
      else:
          pass_tol = 0.2
      with catch_logging() as log:
          x = create_filter(
              None,
              fs,
              l_freq,
              40.0,
              method="iir",
              phase=phase,
              iir_params=iir_params,
              verbose=True,
          )
      order_eff = order * (1 + (btype == "bandpass"))
      if output == "ba":
          assert len(x["b"]) == order_eff + 1
      order_mult = 1.0 if phase == "forward" else 2.0
      log = log.getvalue()
      keys = [
          "IIR",
          btype,
          ftype,
          "Filter order %d" % (order_eff * order_mult,),
          "Cutoff " if btype == "lowpass" else "Cutoffs ",
      ]
      if phase == "forward":
          keys += ["non-linear phase", "one-pass forward", "causal"]
      else:
          keys += [
              "zero-phase",
              "two-pass forward and reverse",
              "non-causal",
          ]
      dB_decade = -27.74
      if ftype == "ellip":
          dB_cutoff = -3.0
      elif order == 1 or ftype == "butter":
          dB_cutoff = -3.01
      else:
          assert ftype == "bessel"
          assert order == 4
          dB_cutoff = -7.58
      dB_cutoff *= order_mult
      if btype == "lowpass":
          keys += ["%0.2f dB" % (dB_cutoff,)]
      for key in keys:
          assert key.lower() in log.lower()
      # Verify some of the filter properties
      if output == "ba":
          w, h = freqz(x["b"], x["a"], worN=10000)
      else:
          w, h = sosfreqz(x["sos"], worN=10000)
      w *= fs / (2 * np.pi)
      h = np.abs(h)
      # passband
      passes = [np.argmin(np.abs(w - 20))]
      # stopband
      decades = [np.argmin(np.abs(w - 400.0))]  # one decade
      # transition
      edges = [np.argmin(np.abs(w - 40.0))]
      # put these where they belong based on filter type
      assert w[0] == 0.0
      idx_0p1 = np.argmin(np.abs(w - 0.1))
      idx_1 = np.argmin(np.abs(w - 1.0))
      if btype == "bandpass":
          edges += [idx_1]
          decades += [idx_0p1]
      else:
          passes += [idx_0p1, idx_1]
  
      edge_val = 10 ** (dB_cutoff / (order_mult * 20.0))
      assert_allclose(h[edges], edge_val, atol=0.01)
      assert_allclose(h[passes], 1.0, atol=pass_tol)
      if ftype == "butter" and btype == "lowpass":
          attenuation = dB_decade * order
          assert_allclose(
              h[decades], 10 ** (attenuation / 20.0), rtol=0.01
          )
      elif ftype == "ellip":
          assert_array_less(h[decades], 10 ** (-rs / 20))
  
imports: import numpy
  import pytest
  from numpy.fft import fft, fftfreq
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_array_less
  from scipy.signal import butter, freqz, sosfreqz
  from scipy.signal import resample
  from mne import Epochs, create_info
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT
  from mne.filter import _length_factors, _overlap_add_filter, _resample_stim_channels, _smart_pad, construct_iir_filter, create_filter, design_mne_c_filter, detrend, estimate_ringing_samples, filter_data, notch_filter, resample
  from mne.io import RawArray, read_raw_fif
  from mne.utils import catch_logging, requires_mne, run_subprocess, sum_squared
label_desc: Use image node_id 19 for calling a global function with example usage: test_reporting_iir(phase, ftype, btype, order, output) without return types