code: def test_export_raw_eeglab(tmp_path):
      """Test saving a Raw instance to EEGLAB's set format."""
      pytest.importorskip("eeglabio")
      raw = read_raw_fif(fname_raw, preload=True)
      raw.apply_proj()
      temp_fname = tmp_path / "test.set"
      raw.export(temp_fname)
      raw.drop_channels([ch for ch in ["epoc"] if ch in raw.ch_names])
  
      with pytest.warns(
          RuntimeWarning, match="is above the 99th percentile"
      ):
          raw_read = read_raw_eeglab(
              temp_fname, preload=True, montage_units="m"
          )
      assert raw.ch_names == raw_read.ch_names
  
      cart_coords = np.array(
          [d["loc"][:3] for d in raw.info["chs"]]
      )  # just xyz
      cart_coords_read = np.array(
          [d["loc"][:3] for d in raw_read.info["chs"]]
      )
      assert_allclose(cart_coords, cart_coords_read)
      assert_allclose(raw.times, raw_read.times)
      assert_allclose(raw.get_data(), raw_read.get_data())
  
      # test overwrite
      with pytest.raises(
          FileExistsError, match="Destination file exists"
      ):
          raw.export(temp_fname, overwrite=False)
      raw.export(temp_fname, overwrite=True)
  
      # test pathlib.Path files
      raw.export(Path(temp_fname), overwrite=True)
  
      # test warning with unapplied projectors
      raw = read_raw_fif(fname_raw, preload=True)
      with pytest.warns(
          RuntimeWarning, match="Raw instance has unapplied projectors."
      ):
          raw.export(temp_fname, overwrite=True)
  
imports: from contextlib import nullcontext
  from datetime import datetime, timezone
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from mne import Annotations, Epochs, create_info, read_epochs_eeglab, read_evokeds, read_evokeds_mff
  from mne.datasets import misc, testing
  from mne.export import export_evokeds, export_evokeds_mff
  from mne.fixes import _compare_version
  from mne.io import RawArray, read_raw_brainvision, read_raw_edf, read_raw_eeglab, read_raw_fif
  from mne.tests.test_epochs import _get_data
  from mne.utils import _check_edfio_installed, _record_warnings, _resource_path, object_diff
label_desc: Use image node_id 2 for calling a global function with example usage: test_export_raw_eeglab(tmp_path) without return types