code: def test_fnirs_check_bads(fname):
      """Test checking of bad markings."""
      # No bad channels, so these should all pass
      raw = read_raw_nirx(fname)
      _fnirs_check_bads(raw.info)
      raw = optical_density(raw)
      _fnirs_check_bads(raw.info)
      raw = beer_lambert_law(raw)
      _fnirs_check_bads(raw.info)
  
      # Mark pairs of bad channels, so these should all pass
      raw = read_raw_nirx(fname)
      raw.info["bads"] = raw.ch_names[0:2]
      _fnirs_check_bads(raw.info)
      raw = optical_density(raw)
      _fnirs_check_bads(raw.info)
      raw = beer_lambert_law(raw)
      _fnirs_check_bads(raw.info)
  
      # Mark single channel as bad, so these should all fail
      raw = read_raw_nirx(fname)
      raw.info["bads"] = raw.ch_names[0:1]
      pytest.raises(RuntimeError, _fnirs_check_bads, raw.info)
      with pytest.raises(RuntimeError, match="bad labelling"):
          raw = optical_density(raw)
      raw.info["bads"] = []
      raw = optical_density(raw)
      raw.info["bads"] = raw.ch_names[0:1]
      pytest.raises(RuntimeError, _fnirs_check_bads, raw.info)
      with pytest.raises(RuntimeError, match="bad labelling"):
          raw = beer_lambert_law(raw)
      pytest.raises(RuntimeError, _fnirs_check_bads, raw.info)
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from mne import create_info
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _picks_to_idx
  from mne.datasets import testing
  from mne.datasets.testing import data_path
  from mne.io import RawArray, read_raw_nirx
  from mne.preprocessing.nirs import _channel_chromophore, _channel_frequencies, _check_channels_ordered, _fnirs_optode_names, _fnirs_spread_bads, _optode_position, _validate_nirs_info, beer_lambert_law, optical_density, scalp_coupling_index, tddr
label_desc: Use image node_id 3 for calling a global function with example usage: test_fnirs_check_bads(fname) without return types