示例#1
0
 def test_slice_datetime_locs(self, box, kind, tz_aware_fixture):
     # GH 34077
     index = DatetimeIndex(["2010-01-01", "2010-01-03"]).tz_localize(
         tz_aware_fixture
     )
     result = index.slice_locs(box(2010, 1, 1), box(2010, 1, 2))
     expected = (0, 1)
     assert result == expected
示例#2
0
    def test_slice_datetime_locs(self, box, kind, tz_aware_fixture):
        # GH 34077
        tz = tz_aware_fixture
        index = DatetimeIndex(["2010-01-01", "2010-01-03"]).tz_localize(tz)
        key = box(2010, 1, 1)

        warn = None if tz is None else FutureWarning
        with tm.assert_produces_warning(warn, check_stacklevel=False):
            # GH#36148 will require tzawareness-compat
            result = index.slice_locs(key, box(2010, 1, 2))
        expected = (0, 1)
        assert result == expected