code: def test_round(self, tz_naive_fixture, unit):
      tz = tz_naive_fixture
      rng = date_range(
          start="2016-01-01", periods=5, freq="30Min", tz=tz, unit=unit
      )
      elt = rng[1]
  
      expected_rng = DatetimeIndex(
          [
              Timestamp("2016-01-01 00:00:00", tz=tz),
              Timestamp("2016-01-01 00:00:00", tz=tz),
              Timestamp("2016-01-01 01:00:00", tz=tz),
              Timestamp("2016-01-01 02:00:00", tz=tz),
              Timestamp("2016-01-01 02:00:00", tz=tz),
          ]
      ).as_unit(unit)
      expected_elt = expected_rng[1]
  
      result = rng.round(freq="h")
      tm.assert_index_equal(result, expected_rng)
      assert elt.round(freq="h") == expected_elt
  
      msg = INVALID_FREQ_ERR_MSG
      with pytest.raises(ValueError, match=msg):
          rng.round(freq="foo")
      with pytest.raises(ValueError, match=msg):
          elt.round(freq="foo")
  
      msg = "<MonthEnd> is a non-fixed frequency"
      with pytest.raises(ValueError, match=msg):
          rng.round(freq="ME")
      with pytest.raises(ValueError, match=msg):
          elt.round(freq="ME")
  
file_path: pandas/pandas/tests/indexes/datetimes/methods/test_round.py
imports: import pytest
  from pandas._libs.tslibs import to_offset
  from pandas._libs.tslibs.offsets import INVALID_FREQ_ERR_MSG
  from pandas import DatetimeIndex, Timestamp, date_range
  import pandas._testing
label_desc: Use image node_id 3 for calling the TestDatetimeIndexRound obj's underlying member method code with example usage: obj.test_round(tz_naive_fixture, unit) without return types