code: def test_read_epochs(cur_system, version, use_info, monkeypatch):
      """Test comparing reading an Epochs object and the FieldTrip version."""
      pandas = _check_pandas_installed(strict=False)
      has_pandas = pandas is not False
      test_data_folder_ft = get_data_paths(cur_system)
      mne_epoched = get_epochs(cur_system)
      if use_info:
          info = get_raw_info(cur_system)
          ctx = nullcontext()
      else:
          info = None
          ctx = pytest.warns(**no_info_warning)
  
      cur_fname = test_data_folder_ft / f"epoched_{version}.mat"
      if has_pandas:
          with ctx:
              epoched_ft = mne.io.read_epochs_fieldtrip(cur_fname, info)
          assert isinstance(epoched_ft.metadata, pandas.DataFrame)
      else:
          with _record_warnings() as warn_record:
              epoched_ft = mne.io.read_epochs_fieldtrip(cur_fname, info)
              assert epoched_ft.metadata is None
              assert_warning_in_record(
                  pandas_not_found_warning_msg, warn_record
              )
              if info is None:
                  assert_warning_in_record(NOINFO_WARNING, warn_record)
  
      mne_data = mne_epoched.get_data(copy=False)[:, :, :-1]
      ft_data = epoched_ft.get_data(copy=False)
  
      check_data(mne_data, ft_data, cur_system)
      check_info_fields(mne_epoched, epoched_ft, use_info)
      read_mat = pymatreader.read_mat
  
      # weird sfreq
      def modify_mat(fname, variable_names=None, ignore_fields=None):
          out = read_mat(fname, variable_names, ignore_fields)
          if "fsample" in out["data"]:
              out["data"]["fsample"] = np.repeat(
                  out["data"]["fsample"], 2
              )
          return out
  
      monkeypatch.setattr(pymatreader, "read_mat", modify_mat)
      with pytest.warns(RuntimeWarning, match="multiple"):
          mne.io.read_epochs_fieldtrip(cur_fname, info)
  
imports: import copy
  import itertools
  from contextlib import nullcontext
  import numpy
  import pytest
  import mne
  from mne.datasets import testing
  from mne.io import read_raw_fieldtrip
  from mne.io.fieldtrip.tests.helpers import assert_warning_in_record, check_data, check_info_fields, get_data_paths, get_epochs, get_evoked, get_raw_data, get_raw_info, pandas_not_found_warning_msg
  from mne.io.fieldtrip.utils import NOINFO_WARNING, _create_events
  from mne.io.tests.test_raw import _test_raw_reader
  from mne.utils import _check_pandas_installed, _record_warnings
label_desc: Use image node_id 2 for calling a global function with example usage: test_read_epochs(cur_system, version, use_info, monkeypatch) and returns: out