code: def test_read_evoked_besa_avr_incomplete(tmp_path):
      """Test reading incomplete BESA .avr files."""
      # Check old style .avr file without an .elp sidecar
      with open(f"{tmp_path}/missing.avr", "w") as f:
          f.write(
              "Npts= 1  TSB= 0  SB= 1.00  SC= 500.0  DI= 5\n0\n1\n2\n"
          )
      ev = read_evoked_besa(f"{tmp_path}/missing.avr")
      assert ev.ch_names == ["CH01", "CH02", "CH03"]
  
      # Create BESA file with missing header fields and verify things don't break
      with open(f"{tmp_path}/missing.avr", "w") as f:
          f.write("DI= 5\n0\n")
      ev = read_evoked_besa(f"{tmp_path}/missing.avr")
      assert len(ev.ch_names) == len(ev.data) == 1
      assert ev.info["sfreq"] == 200
      assert ev.tmin == 0
      assert len(ev.times) == 1
      assert ev.ch_names == ["CH01"]
      assert ev.comment == ""
  
      # The DI field (sample frequency) must exist
      with open(f"{tmp_path}/missing.avr", "w") as f:
          f.write("Npts= 1  TSB= 0  SB= 1.00  SC= 500.0\n0\n")
      with pytest.raises(RuntimeError, match='No "DI" field present'):
          ev = read_evoked_besa(f"{tmp_path}/missing.avr")
  
imports: import inspect
  from pathlib import Path
  import pytest
  from mne.channels import read_custom_montage
  from mne.io import read_evoked_besa
label_desc: Use image node_id 2 for calling a global function with example usage: test_read_evoked_besa_avr_incomplete(tmp_path) without return types