code: def test_annotation_rename():
      """Test annotation renaming works."""
      a = Annotations([1, 2, 3], [5, 5, 8], ["a", "b", "c"])
      assert isinstance(a.description, np.ndarray)
      assert len(a) == 3
      assert "a" in a.description
      assert "b" in a.description
      assert "c" in a.description
      assert "new_name" not in a.description
  
      a = Annotations([1, 2, 3], [5, 5, 8], ["a", "b", "c"])
      a.rename({"a": "new_name"})
      assert isinstance(a.description, np.ndarray)
      assert len(a) == 3
      assert "a" not in a.description
      assert "new_name" in a.description
      assert np.where([d == "new_name" for d in a.description])[0] == 0
  
      a = Annotations([1, 2, 3], [5, 5, 8], ["a", "b", "c"])
      a.rename({"a": "new_name", "b": "new name b"})
      assert len(a) == 3
      assert "a" not in a.description
      assert "new_name" in a.description
      assert "b" not in a.description
      assert "new name b" in a.description
      assert np.where([d == "new_name" for d in a.description])[0] == 0
      assert (
          np.where([d == "new name b" for d in a.description])[0] == 1
      )
  
      a = Annotations([1, 2, 3], [5, 5, 8], ["a", "b", "c"])
      a.rename({"b": "new_name", "c": "new name c"})
      assert isinstance(a.description, np.ndarray)
      assert len(a) == 3
      assert "b" not in a.description
      assert "new_name" in a.description
      assert "c" not in a.description
      assert "new name c" in a.description
      assert "a" in a.description
      assert np.where([d == "new_name" for d in a.description])[0] == 1
      assert (
          np.where([d == "new name c" for d in a.description])[0] == 2
      )
      assert (
          len(np.where([d == "new name b" for d in a.description])[0])
          == 0
      )
  
      a = Annotations([1, 2, 3], [5, 5, 8], ["a", "b", "c"])
      with pytest.raises(ValueError, match="not present in data"):
          a.rename({"aaa": "does not exist"})
      with pytest.raises(ValueError, match="[' a']"):
          a.rename({" a": "does not exist"})
      with pytest.raises(
          TypeError, match="dict, got <class 'str'> instead"
      ):
          a.rename("wrong")
      with pytest.raises(
          TypeError, match="dict, got <class 'list'> instead"
      ):
          a.rename(["wrong"])
      with pytest.raises(
          TypeError, match="dict, got <class 'set'> instead"
      ):
          a.rename({"wrong"})
  
      a = np.array([[0, 0, 11], [1000, 0, 1], [1230, 0, 111]])
      a = mne.annotations_from_events(a, 256)
      a.rename({"1": "A", "11": "B", "111": "C"})
      assert_array_equal(a.description, ["B", "A", "C"])
  
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 45 for calling a global function with example usage: test_annotation_rename() without return types