code: def test_sorting():
      """Test annotation sorting."""
      annot = Annotations([10, 20, 30], [1, 2, 3], "BAD")
      # assert_array_equal(annot.onset, [0, 5, 10])
      annot.append([5, 15, 25, 35], 0.5, "BAD")
      onset = list(range(5, 36, 5))
      duration = list(annot.duration)
      assert_array_equal(annot.onset, onset)
      assert_array_equal(annot.duration, duration)
      annot.append(
          [10, 10], [0.1, 9], "BAD"
      )  # 0.1 should be before, 9 after
      want_before = onset.index(10)
      duration.insert(want_before, 0.1)
      duration.insert(want_before + 2, 9)
      onset.insert(want_before, 10)
      onset.insert(want_before, 10)
      assert_array_equal(annot.onset, onset)
      assert_array_equal(annot.duration, duration)
  
imports: import sys
  from collections import OrderedDict
  from datetime import datetime, timedelta, timezone
  from itertools import repeat
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from pytest import approx
  import mne
  from mne import Annotations, Epochs, annotations_from_events, count_annotations, create_info, events_from_annotations, read_annotations
  from mne.annotations import _handle_meas_date, _read_annotations_txt_parse_header, _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray, concatenate_raws, read_raw_fif
  from mne.utils import _dt_to_stamp, _raw_annot, _record_warnings, _stamp_to_dt, assert_and_remove_boundary_annot, catch_logging, check_version
label_desc: Use image node_id 34 for calling a global function with example usage: test_sorting() without return types