code: def test_export_epochs_eeglab(tmp_path, preload):
      """Test saving an Epochs instance to EEGLAB's set format."""
      eeglabio = pytest.importorskip("eeglabio")
      raw, events = _get_data()[:2]
      raw.load_data()
      epochs = Epochs(raw, events, preload=preload)
      temp_fname = tmp_path / "test.set"
      # TODO: eeglabio 0.2 warns about invalid events
      if _compare_version(eeglabio.__version__, "==", "0.0.2-1"):
          ctx = _record_warnings
      else:
          ctx = nullcontext
      with ctx():
          epochs.export(temp_fname)
      epochs.drop_channels(
          [ch for ch in ["epoc", "STI 014"] if ch in epochs.ch_names]
      )
      epochs_read = read_epochs_eeglab(temp_fname)
      assert epochs.ch_names == epochs_read.ch_names
      cart_coords = np.array(
          [d["loc"][:3] for d in epochs.info["chs"]]
      )  # just xyz
      cart_coords_read = np.array(
          [d["loc"][:3] for d in epochs_read.info["chs"]]
      )
      assert_allclose(cart_coords, cart_coords_read)
      assert_array_equal(
          epochs.events[:, 0], epochs_read.events[:, 0]
      )  # latency
      assert (
          epochs.event_id.keys() == epochs_read.event_id.keys()
      )  # just keys
      assert_allclose(epochs.times, epochs_read.times)
      assert_allclose(epochs.get_data(), epochs_read.get_data())
  
      # test overwrite
      with pytest.raises(
          FileExistsError, match="Destination file exists"
      ):
          epochs.export(temp_fname, overwrite=False)
      with ctx():
          epochs.export(temp_fname, overwrite=True)
  
      # test pathlib.Path files
      with ctx():
          epochs.export(Path(temp_fname), overwrite=True)
  
      # test warning with unapplied projectors
      epochs = Epochs(raw, events, preload=preload, proj=False)
      with pytest.warns(
          RuntimeWarning,
          match="Epochs instance has unapplied projectors.",
      ):
          epochs.export(Path(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 13 for calling a global function with example usage: test_export_epochs_eeglab(tmp_path, preload) without return types