code: def test_make_fixed_length_events():
      """Test making events of a fixed length."""
      raw = read_raw_fif(raw_fname)
      events = make_fixed_length_events(raw, id=1)
      assert events.shape[1] == 3
      events_zero = make_fixed_length_events(raw, 1, first_samp=False)
      assert_equal(events_zero[0, 0], 0)
      assert_array_equal(
          events_zero[:, 0], events[:, 0] - raw.first_samp
      )
      # With limits
      tmin, tmax = raw.times[[0, -1]]
      duration = tmax - tmin
      events = make_fixed_length_events(raw, 1, tmin, tmax, duration)
      assert_equal(events.shape[0], 1)
      # With bad limits (no resulting events)
      pytest.raises(
          ValueError,
          make_fixed_length_events,
          raw,
          1,
          tmin,
          tmax - 1e-3,
          duration,
      )
      # not raw, bad id or duration
      pytest.raises(TypeError, make_fixed_length_events, raw, 2.3)
      pytest.raises(TypeError, make_fixed_length_events, "not raw", 2)
      pytest.raises(
          TypeError,
          make_fixed_length_events,
          raw,
          23,
          tmin,
          tmax,
          "abc",
      )
  
      # Let's try some ugly sample rate/sample count combos
      data = np.random.RandomState(0).randn(1, 27768)
  
      # This breaks unless np.round() is used in make_fixed_length_events
      info = create_info(1, 155.4499969482422)
      raw = RawArray(data, info)
      events = make_fixed_length_events(raw, 1, duration=raw.times[-1])
      assert events[0, 0] == 0
      assert len(events) == 1
  
      # Without use_rounding=True this breaks
      raw = RawArray(data[:, :21216], info)
      events = make_fixed_length_events(raw, 1, duration=raw.times[-1])
      assert events[0, 0] == 0
      assert len(events) == 1
  
      # Make sure it gets used properly by compute_raw_covariance
      cov = compute_raw_covariance(raw, tstep=None)
      expected = np.cov(data[:, :21216])
      assert_allclose(cov["data"], expected, atol=1e-12)
  
      # overlaps
      events = make_fixed_length_events(raw, 1, duration=1)
      assert len(events) == 136
      events_ol = make_fixed_length_events(
          raw, 1, duration=1, overlap=0.5
      )
      assert len(events_ol) == 271
      events_ol_2 = make_fixed_length_events(
          raw, 1, duration=1, overlap=0.9
      )
      assert len(events_ol_2) == 1355
      assert_array_equal(
          events_ol_2[:, 0], np.unique(events_ol_2[:, 0])
      )
      with pytest.raises(ValueError, match="overlap must be"):
          make_fixed_length_events(raw, 1, duration=1, overlap=1.1)
  
imports: import os
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from mne import Annotations, Epochs, compute_raw_covariance, count_events, create_info, find_events, find_stim_steps, make_fixed_length_events, pick_channels, pick_events, read_events, read_evokeds, write_events
  from mne.datasets import testing
  from mne.event import AcqParserFIF, define_target_events, match_event_names, merge_events, shift_time_events
  from mne.io import RawArray, read_raw_fif
label_desc: Use image node_id 8 for calling a global function with example usage: test_make_fixed_length_events() without return types