code: def test_basics():
      """Test annotation class."""
      raw = read_raw_fif(fif_fname)
      assert raw.annotations is not None
      assert len(raw.annotations.onset) == 0
      pytest.raises(OSError, read_annotations, fif_fname)
      onset = np.array(range(10))
      duration = np.ones(10)
      description = np.repeat("test", 10)
      dt = raw.info["meas_date"]
      assert isinstance(dt, datetime)
      stamp = _dt_to_stamp(dt)
      # Test time shifts.
      for orig_time in [None, dt, stamp[0], stamp]:
          annot = Annotations(onset, duration, description, orig_time)
          if orig_time is None:
              assert annot.orig_time is None
          else:
              assert isinstance(annot.orig_time, datetime)
              assert annot.orig_time.tzinfo is timezone.utc
  
      pytest.raises(
          ValueError, Annotations, onset, duration, description[:9]
      )
      pytest.raises(
          ValueError, Annotations, [onset, 1], duration, description
      )
      pytest.raises(
          ValueError, Annotations, onset, [duration, 1], description
      )
  
      # Test combining annotations with concatenate_raws
      raw2 = raw.copy()
      delta = raw.times[-1] + 1.0 / raw.info["sfreq"]
      orig_time = stamp[0] + stamp[1] * 1e-6 + raw2._first_time
      offset = _dt_to_stamp(_handle_meas_date(raw2.info["meas_date"]))
      offset = offset[0] + offset[1] * 1e-6
      offset = orig_time - offset
      assert_allclose(offset, raw._first_time)
      annot = Annotations(onset, duration, description, orig_time)
      assert annot.orig_time is not None
      assert " segments" in repr(annot)
      raw2.set_annotations(annot)
      assert_allclose(raw2.annotations.onset, onset + offset)
      assert raw2.annotations is not annot
      assert raw2.annotations.orig_time is not None
      concatenate_raws([raw, raw2])
      assert_and_remove_boundary_annot(raw)
      assert_allclose(
          onset + offset + delta, raw.annotations.onset, rtol=1e-5
      )
      assert_array_equal(annot.duration, raw.annotations.duration)
      assert_array_equal(
          raw.annotations.description, np.repeat("test", 10)
      )
  
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 2 for calling a global function with example usage: test_basics() without return types