code: def test_load_generator(fname, recwarn):
      """Test IO of annotations from edf and bdf files with raw info."""
      if fname.suffix == ".edf":
          raw = read_raw_edf(fname)
      elif fname.suffix == ".bdf":
          raw = read_raw_bdf(fname)
      assert len(raw.annotations.onset) == 2
      found_types = [
          k
          for k, v in channel_indices_by_type(
              raw.info, picks=None
          ).items()
          if v
      ]
      assert len(found_types) == 1
      events, event_id = events_from_annotations(raw)
      ch_names = [
          "squarewave",
          "ramp",
          "pulse",
          "ECG",
          "noise",
          "sine 1 Hz",
          "sine 8 Hz",
          "sine 8.5 Hz",
          "sine 15 Hz",
          "sine 17 Hz",
          "sine 50 Hz",
      ]
      assert raw.get_data().shape == (11, 120000)
      assert raw.ch_names == ch_names
      assert event_id == {"RECORD START": 2, "REC STOP": 1}
      assert_array_equal(events, [[0, 0, 2], [120000, 0, 1]])
  
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 22 for calling a global function with example usage: test_load_generator(fname, recwarn) without return types