code: def test_edf_different_sfreqs(stim_channel):
      """Test EDF with various sampling rates."""
      rng = np.random.RandomState(0)
      # load with and without preloading, should produce the same results
      raw1 = read_raw_edf(
          input_fname=edf_reduced,
          stim_channel=stim_channel,
          verbose="error",
          preload=False,
      )
      raw2 = read_raw_edf(
          input_fname=edf_reduced,
          stim_channel=stim_channel,
          verbose="error",
          preload=True,
      )
  
      picks = rng.permutation(np.arange(len(raw1.ch_names) - 1))[:10]
      data1, times1 = raw1[picks, :]
      data2, times2 = raw2[picks, :]
      assert_allclose(
          data1, data2, err_msg="Data mismatch with preload"
      )
      assert_allclose(times1, times2)
  
      # loading slices should throw a warning as they have different
      # edge artifacts than when loading the entire file at once
      with pytest.warns(
          RuntimeWarning, match="mixed sampling frequencies"
      ):
          data1, times1 = raw1[picks, :512]
      data2, times2 = raw2[picks, :512]
  
      # should NOT throw a warning when loading channels that have all the same
      # sampling frequency - here, no edge artifacts can appear
      picks = np.arange(15, 20)  # these channels all have 512 Hz
      data1, times1 = raw1[picks, :512]
      data2, times2 = raw2[picks, :512]
      assert_allclose(
          data1, data2, err_msg="Data mismatch with preload"
      )
      assert_allclose(times1, times2)
  
imports: import datetime
  from contextlib import nullcontext
  from functools import partial
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy.io import loadmat
  from mne import Annotations, pick_types
  from mne._fiff.pick import channel_indices_by_type, get_channel_type_constants
  from mne.annotations import _ndarray_ch_names, events_from_annotations, read_annotations
  from mne.datasets import testing
  from mne.io import edf, read_raw_bdf, read_raw_edf, read_raw_fif, read_raw_gdf
  from mne.io.edf.edf import _edf_str, _parse_prefilter_string, _read_annotations_edf, _read_ch, _read_edf_header, _read_header
  from mne.io.tests.test_raw import _test_raw_reader
  from mne.tests.test_annotations import _assert_annotations_equal
label_desc: Use image node_id 8 for calling a global function with example usage: test_edf_different_sfreqs(stim_channel) without return types