code: def test_invalid_headers():
      """Test that invalid headers raise exceptions."""
      tpl = b"""<nedf>
          <NEDFversion>1.3</NEDFversion>
          <EEGSettings>
              %s
              <EEGMontage><C>A</C><C>B</C><C>C</C><C>D</C></EEGMontage>
          </EEGSettings>
      </nedf>\x00"""
      nchan = b"<TotalNumberOfChannels>4</TotalNumberOfChannels>"
      sr = b"<EEGSamplingRate>500</EEGSamplingRate>"
      hdr = {
          "null": b"No null terminator",
          "Unknown additional": (
              b"<a><NEDFversion>1.3</NEDFversion>"
              + b"<AdditionalChannelStatus>???</AdditionalChannelStatus></a>\x00"
          ),  # noqa: E501
          "No EEG channels found": b"<a><NEDFversion>1.3</NEDFversion></a>\x00",
          "TotalNumberOfChannels not found": tpl % b"No nchan.",
          "!= channel count": tpl
          % (sr + b"<TotalNumberOfChannels>52</TotalNumberOfChannels>"),
          "EEGSamplingRate not found": tpl % nchan,
          "NumberOfRecordsOfEEG not found": tpl % (sr + nchan),
      }
      for match, invalid_hdr in hdr.items():
          with pytest.raises(RuntimeError, match=match):
              _parse_nedf_header(invalid_hdr)
  
      sus_hdrs = {
          "unsupported": b"<a><NEDFversion>25</NEDFversion></a>\x00",
          "tested": (
              b"<a><NEDFversion>1.3</NEDFversion><stepDetails>"
              + b"<DeviceClass>STARSTIM</DeviceClass></stepDetails></a>\x00"
          ),
      }
      for match, sus_hdr in sus_hdrs.items():
          with pytest.warns(RuntimeWarning, match=match):
              with pytest.raises(
                  RuntimeError, match="No EEG channels found"
              ):
                  _parse_nedf_header(sus_hdr)
  
file_path: mne-python/mne/io/nedf/tests/test_nedf.py
imports: import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import find_events
  from mne._fiff.constants import FIFF
  from mne.datasets import testing
  from mne.io.nedf import _parse_nedf_header, read_raw_nedf
  from mne.io.tests.test_raw import _test_raw_reader
label_desc: Use image node_id 2 for calling a global function with example usage: test_invalid_headers() without return types