code: def test_getitem_str_year_with_datetimeindex():
      idx = [
          Timestamp("2013-05-31 00:00"),
          Timestamp(datetime(2013, 5, 31, 23, 59, 59, 999999)),
      ]
      ts = Series(range(len(idx)), index=idx)
      expected = ts["2013"]
      tm.assert_series_equal(expected, ts)
  
imports: from datetime import datetime, timedelta
  import re
  from dateutil.tz import gettz, tzutc
  import numpy
  import pytest
  import pytz
  from pandas._libs import index
  import pandas
  from pandas import DataFrame, Series, Timestamp, date_range, period_range
  import pandas._testing
label_desc: Use image node_id 14 for calling a global function with example usage: test_getitem_str_year_with_datetimeindex() without return types