prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  DateTimeIndex.__iter__().next() rounds time to microseconds, when timezone aware
  #### Code Sample
  
  ```python
  >> import pandas as pd
  >> datetimeindex = pd.DatetimeIndex(["2018-02-08 15:00:00.168456358"])
  >> datetimeindex
  DatetimeIndex(['2018-02-08 15:00:00.168456358'], dtype='datetime64[ns]', freq=None)
  >> datetimeindex = datetimeindex.tz_localize(datetime.timezone.utc)
  >> datetimeindex
  DatetimeIndex(['2018-02-08 15:00:00.168456358+00:00'], dtype='datetime64[ns, UTC+00:00]', freq=None)
  >> datetimeindex.__getitem__(0)
  Timestamp('2018-02-08 15:00:00.168456358+0000', tz='UTC+00:00')
  >> datetimeindex.__iter__().__next__()
  Timestamp('2018-02-08 15:00:00.168456+0000', tz='UTC+00:00')
  ```
  #### Problem description
  
  When using localize DateTimeIndex with nanosecond precision, __getitem__ behavious differs from __iter__().__next__ behaviour, as when iterating thought the DateTimeIndex the date is round to microseconds. This doen not happends if the DatetimeIndex has no timezone.
  
  #### Output of ``pd.show_versions()``
  
  <details>
  
  INSTALLED VERSIONS
  ------------------
  commit: None
  python: 3.4.2.final.0
  python-bits: 64
  OS: Linux
  OS-release: 4.9.0-0.bpo.2-amd64
  machine: x86_64
  processor: 
  byteorder: little
  LC_ALL: None
  LANG: en_US.UTF-8
  LOCALE: en_US.UTF-8
  
  pandas: 0.22.0
  pytest: None
  pip: 9.0.1
  setuptools: 36.5.0
  Cython: None
  numpy: 1.14.0
  scipy: 1.0.0
  pyarrow: None
  xarray: None
  IPython: 6.2.1
  sphinx: None
  patsy: None
  dateutil: 2.6.1
  pytz: 2017.3
  blosc: None
  bottleneck: None
  tables: None
  numexpr: None
  feather: None
  matplotlib: 2.0.2
  openpyxl: None
  xlrd: None
  xlwt: None
  xlsxwriter: None
  lxml: None
  bs4: None
  html5lib: None
  sqlalchemy: None
  pymysql: None
  psycopg2: None
  jinja2: None
  s3fs: None
  fastparquet: None
  pandas_gbq: None
  pandas_datareader: None
  
  </details>
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pandas/conftest.py`
  Content:
  ```
  1 import pytest
  2 
  3 from distutils.version import LooseVersion
  4 import numpy
  5 import pandas
  6 import dateutil
  7 import pandas.util._test_decorators as td
  8 
  9 
  10 def pytest_addoption(parser):
  11     parser.addoption("--skip-slow", action="store_true",
  12                      help="skip slow tests")
  13     parser.addoption("--skip-network", action="store_true",
  14                      help="skip network tests")
  15     parser.addoption("--run-high-memory", action="store_true",
  16                      help="run high memory tests")
  17     parser.addoption("--only-slow", action="store_true",
  18                      help="run only slow tests")
  19 
  20 
  21 def pytest_runtest_setup(item):
  22     if 'slow' in item.keywords and item.config.getoption("--skip-slow"):
  23         pytest.skip("skipping due to --skip-slow")
  24 
  25     if 'slow' not in item.keywords and item.config.getoption("--only-slow"):
  26         pytest.skip("skipping due to --only-slow")
  27 
  28     if 'network' in item.keywords and item.config.getoption("--skip-network"):
  29         pytest.skip("skipping due to --skip-network")
  30 
  31     if 'high_memory' in item.keywords and not item.config.getoption(
  32             "--run-high-memory"):
  33         pytest.skip(
  34             "skipping high memory test since --run-high-memory was not set")
  35 
  36 
  37 # Configurations for all tests and all test modules
  38 
  39 @pytest.fixture(autouse=True)
  40 def configure_tests():
  41     pandas.set_option('chained_assignment', 'raise')
  42 
  43 
  44 # For running doctests: make np and pd names available
  45 
  46 @pytest.fixture(autouse=True)
  47 def add_imports(doctest_namespace):
  48     doctest_namespace['np'] = numpy
  49     doctest_namespace['pd'] = pandas
  50 
  51 
  52 @pytest.fixture(params=['bsr', 'coo', 'csc', 'csr', 'dia', 'dok', 'lil'])
  53 def spmatrix(request):
  54     from scipy import sparse
  55     return getattr(sparse, request.param + '_matrix')
  56 
  57 
  58 @pytest.fixture
  59 def ip():
  60     """
  61     Get an instance of IPython.InteractiveShell.
  62 
  63     Will raise a skip if IPython is not installed.
  64     """
  65 
  66     pytest.importorskip('IPython', minversion="6.0.0")
  67     from IPython.core.interactiveshell import InteractiveShell
  68     return InteractiveShell()
  69 
  70 
  71 is_dateutil_le_261 = pytest.mark.skipif(
  72     LooseVersion(dateutil.__version__) > LooseVersion('2.6.1'),
  73     reason="dateutil api change version")
  74 is_dateutil_gt_261 = pytest.mark.skipif(
  75     LooseVersion(dateutil.__version__) <= LooseVersion('2.6.1'),
  76     reason="dateutil stable version")
  77 
  78 
  79 @pytest.fixture(params=[None, 'gzip', 'bz2', 'zip',
  80                         pytest.param('xz', marks=td.skip_if_no_lzma)])
  81 def compression(request):
  82     """
  83     Fixture for trying common compression types in compression tests
  84     """
  85     return request.param
  86 
  87 
  88 @pytest.fixture(params=[None, 'gzip', 'bz2',
  89                         pytest.param('xz', marks=td.skip_if_no_lzma)])
  90 def compression_no_zip(request):
  91     """
  92     Fixture for trying common compression types in compression tests
  93     except zip
  94     """
  95     return request.param
  96
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pandas/conftest.py b/pandas/conftest.py
  --- a/pandas/conftest.py
  +++ b/pandas/conftest.py
  @@ -93,3 +93,9 @@
       except zip
       """
       return request.param
  +
  +
  +@pytest.fixture(scope='module')
  +def datetime_tz_utc():
  +    from datetime import timezone
  +    return timezone.utc
  
verification_info: {"golden_diff": "diff --git a/pandas/conftest.py b/pandas/conftest.py\n--- a/pandas/conftest.py\n+++ b/pandas/conftest.py\n@@ -93,3 +93,9 @@\n     except zip\n     \"\"\"\n     return request.param\n+\n+\n+@pytest.fixture(scope='module')\n+def datetime_tz_utc():\n+    from datetime import timezone\n+    return timezone.utc\n", "issue": "DateTimeIndex.__iter__().next() rounds time to microseconds, when timezone aware\n#### Code Sample\r\n\r\n```python\r\n>> import pandas as pd\r\n>> datetimeindex = pd.DatetimeIndex([\"2018-02-08 15:00:00.168456358\"])\r\n>> datetimeindex\r\nDatetimeIndex(['2018-02-08 15:00:00.168456358'], dtype='datetime64[ns]', freq=None)\r\n>> datetimeindex = datetimeindex.tz_localize(datetime.timezone.utc)\r\n>> datetimeindex\r\nDatetimeIndex(['2018-02-08 15:00:00.168456358+00:00'], dtype='datetime64[ns, UTC+00:00]', freq=None)\r\n>> datetimeindex.__getitem__(0)\r\nTimestamp('2018-02-08 15:00:00.168456358+0000', tz='UTC+00:00')\r\n>> datetimeindex.__iter__().__next__()\r\nTimestamp('2018-02-08 15:00:00.168456+0000', tz='UTC+00:00')\r\n```\r\n#### Problem description\r\n\r\nWhen using localize DateTimeIndex with nanosecond precision, __getitem__ behavious differs from __iter__().__next__ behaviour, as when iterating thought the DateTimeIndex the date is round to microseconds. This doen not happends if the DatetimeIndex has no timezone.\r\n\r\n#### Output of ``pd.show_versions()``\r\n\r\n<details>\r\n\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 3.4.2.final.0\r\npython-bits: 64\r\nOS: Linux\r\nOS-release: 4.9.0-0.bpo.2-amd64\r\nmachine: x86_64\r\nprocessor: \r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_US.UTF-8\r\nLOCALE: en_US.UTF-8\r\n\r\npandas: 0.22.0\r\npytest: None\r\npip: 9.0.1\r\nsetuptools: 36.5.0\r\nCython: None\r\nnumpy: 1.14.0\r\nscipy: 1.0.0\r\npyarrow: None\r\nxarray: None\r\nIPython: 6.2.1\r\nsphinx: None\r\npatsy: None\r\ndateutil: 2.6.1\r\npytz: 2017.3\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nfeather: None\r\nmatplotlib: 2.0.2\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: None\r\nhtml5lib: None\r\nsqlalchemy: None\r\npymysql: None\r\npsycopg2: None\r\njinja2: None\r\ns3fs: None\r\nfastparquet: None\r\npandas_gbq: None\r\npandas_datareader: None\r\n\r\n</details>\r\n\n", "before_files": [{"content": "import pytest\n\nfrom distutils.version import LooseVersion\nimport numpy\nimport pandas\nimport dateutil\nimport pandas.util._test_decorators as td\n\n\ndef pytest_addoption(parser):\n    parser.addoption(\"--skip-slow\", action=\"store_true\",\n                     help=\"skip slow tests\")\n    parser.addoption(\"--skip-network\", action=\"store_true\",\n                     help=\"skip network tests\")\n    parser.addoption(\"--run-high-memory\", action=\"store_true\",\n                     help=\"run high memory tests\")\n    parser.addoption(\"--only-slow\", action=\"store_true\",\n                     help=\"run only slow tests\")\n\n\ndef pytest_runtest_setup(item):\n    if 'slow' in item.keywords and item.config.getoption(\"--skip-slow\"):\n        pytest.skip(\"skipping due to --skip-slow\")\n\n    if 'slow' not in item.keywords and item.config.getoption(\"--only-slow\"):\n        pytest.skip(\"skipping due to --only-slow\")\n\n    if 'network' in item.keywords and item.config.getoption(\"--skip-network\"):\n        pytest.skip(\"skipping due to --skip-network\")\n\n    if 'high_memory' in item.keywords and not item.config.getoption(\n            \"--run-high-memory\"):\n        pytest.skip(\n            \"skipping high memory test since --run-high-memory was not set\")\n\n\n# Configurations for all tests and all test modules\n\n@pytest.fixture(autouse=True)\ndef configure_tests():\n    pandas.set_option('chained_assignment', 'raise')\n\n\n# For running doctests: make np and pd names available\n\n@pytest.fixture(autouse=True)\ndef add_imports(doctest_namespace):\n    doctest_namespace['np'] = numpy\n    doctest_namespace['pd'] = pandas\n\n\n@pytest.fixture(params=['bsr', 'coo', 'csc', 'csr', 'dia', 'dok', 'lil'])\ndef spmatrix(request):\n    from scipy import sparse\n    return getattr(sparse, request.param + '_matrix')\n\n\n@pytest.fixture\ndef ip():\n    \"\"\"\n    Get an instance of IPython.InteractiveShell.\n\n    Will raise a skip if IPython is not installed.\n    \"\"\"\n\n    pytest.importorskip('IPython', minversion=\"6.0.0\")\n    from IPython.core.interactiveshell import InteractiveShell\n    return InteractiveShell()\n\n\nis_dateutil_le_261 = pytest.mark.skipif(\n    LooseVersion(dateutil.__version__) > LooseVersion('2.6.1'),\n    reason=\"dateutil api change version\")\nis_dateutil_gt_261 = pytest.mark.skipif(\n    LooseVersion(dateutil.__version__) <= LooseVersion('2.6.1'),\n    reason=\"dateutil stable version\")\n\n\n@pytest.fixture(params=[None, 'gzip', 'bz2', 'zip',\n                        pytest.param('xz', marks=td.skip_if_no_lzma)])\ndef compression(request):\n    \"\"\"\n    Fixture for trying common compression types in compression tests\n    \"\"\"\n    return request.param\n\n\n@pytest.fixture(params=[None, 'gzip', 'bz2',\n                        pytest.param('xz', marks=td.skip_if_no_lzma)])\ndef compression_no_zip(request):\n    \"\"\"\n    Fixture for trying common compression types in compression tests\n    except zip\n    \"\"\"\n    return request.param\n", "path": "pandas/conftest.py"}], "after_files": [{"content": "import pytest\n\nfrom distutils.version import LooseVersion\nimport numpy\nimport pandas\nimport dateutil\nimport pandas.util._test_decorators as td\n\n\ndef pytest_addoption(parser):\n    parser.addoption(\"--skip-slow\", action=\"store_true\",\n                     help=\"skip slow tests\")\n    parser.addoption(\"--skip-network\", action=\"store_true\",\n                     help=\"skip network tests\")\n    parser.addoption(\"--run-high-memory\", action=\"store_true\",\n                     help=\"run high memory tests\")\n    parser.addoption(\"--only-slow\", action=\"store_true\",\n                     help=\"run only slow tests\")\n\n\ndef pytest_runtest_setup(item):\n    if 'slow' in item.keywords and item.config.getoption(\"--skip-slow\"):\n        pytest.skip(\"skipping due to --skip-slow\")\n\n    if 'slow' not in item.keywords and item.config.getoption(\"--only-slow\"):\n        pytest.skip(\"skipping due to --only-slow\")\n\n    if 'network' in item.keywords and item.config.getoption(\"--skip-network\"):\n        pytest.skip(\"skipping due to --skip-network\")\n\n    if 'high_memory' in item.keywords and not item.config.getoption(\n            \"--run-high-memory\"):\n        pytest.skip(\n            \"skipping high memory test since --run-high-memory was not set\")\n\n\n# Configurations for all tests and all test modules\n\n@pytest.fixture(autouse=True)\ndef configure_tests():\n    pandas.set_option('chained_assignment', 'raise')\n\n\n# For running doctests: make np and pd names available\n\n@pytest.fixture(autouse=True)\ndef add_imports(doctest_namespace):\n    doctest_namespace['np'] = numpy\n    doctest_namespace['pd'] = pandas\n\n\n@pytest.fixture(params=['bsr', 'coo', 'csc', 'csr', 'dia', 'dok', 'lil'])\ndef spmatrix(request):\n    from scipy import sparse\n    return getattr(sparse, request.param + '_matrix')\n\n\n@pytest.fixture\ndef ip():\n    \"\"\"\n    Get an instance of IPython.InteractiveShell.\n\n    Will raise a skip if IPython is not installed.\n    \"\"\"\n\n    pytest.importorskip('IPython', minversion=\"6.0.0\")\n    from IPython.core.interactiveshell import InteractiveShell\n    return InteractiveShell()\n\n\nis_dateutil_le_261 = pytest.mark.skipif(\n    LooseVersion(dateutil.__version__) > LooseVersion('2.6.1'),\n    reason=\"dateutil api change version\")\nis_dateutil_gt_261 = pytest.mark.skipif(\n    LooseVersion(dateutil.__version__) <= LooseVersion('2.6.1'),\n    reason=\"dateutil stable version\")\n\n\n@pytest.fixture(params=[None, 'gzip', 'bz2', 'zip',\n                        pytest.param('xz', marks=td.skip_if_no_lzma)])\ndef compression(request):\n    \"\"\"\n    Fixture for trying common compression types in compression tests\n    \"\"\"\n    return request.param\n\n\n@pytest.fixture(params=[None, 'gzip', 'bz2',\n                        pytest.param('xz', marks=td.skip_if_no_lzma)])\ndef compression_no_zip(request):\n    \"\"\"\n    Fixture for trying common compression types in compression tests\n    except zip\n    \"\"\"\n    return request.param\n\n\n@pytest.fixture(scope='module')\ndef datetime_tz_utc():\n    from datetime import timezone\n    return timezone.utc\n", "path": "pandas/conftest.py"}]}