code: def test_progressbar(monkeypatch):
      """Test progressbar class."""
      a = np.arange(10)
      pbar = ProgressBar(a)
      assert a is pbar.iterable
      assert pbar.max_value == 10
  
      pbar = ProgressBar(10)
      assert pbar.max_value == 10
      assert pbar.iterable is None
  
      # Make sure that non-iterable input raises an error
      def iter_func(a):
          for ii in a:
              pass
  
      with pytest.raises(TypeError, match="not iterable"):
          iter_func(pbar)
  
      # Make sure different progress bars can be used
      monkeypatch.setenv("MNE_TQDM", "tqdm")
      with catch_logging("debug") as log, ProgressBar(
          np.arange(3)
      ) as pbar:
          for p in pbar:
              pass
      log = log.getvalue()
      assert "Using ProgressBar with tqdm\n" in log
      monkeypatch.setenv("MNE_TQDM", "broken")
      with pytest.raises(ValueError, match="Invalid value for the"):
          ProgressBar(np.arange(3))
      monkeypatch.setenv("MNE_TQDM", "tqdm.broken")
      with pytest.raises(ValueError, match="Unknown tqdm"):
          ProgressBar(np.arange(3))
      # off
      monkeypatch.setenv("MNE_TQDM", "off")
      with catch_logging("debug") as log, ProgressBar(
          np.arange(3)
      ) as pbar:
          for p in pbar:
              pass
      log = log.getvalue()
      assert "Using ProgressBar with off\n" == log
  
file_path: mne-python/mne/utils/tests/test_progressbar.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from mne.parallel import parallel_func
  from mne.utils import ProgressBar, array_split_idx, catch_logging, use_log_level
label_desc: Use image node_id 1 for calling a global function with example usage: test_progressbar(monkeypatch) without return types