def test_dti_sub_tdi(self, tz):
    dti = DatetimeIndex(([Timestamp('2017-01-01', tz=tz)] * 10))
    tdi = pd.timedelta_range('0 days', periods=10)
    expected = pd.date_range('2017-01-01', periods=10, tz=tz, freq='-1D')
    result = (dti - tdi)
    tm.assert_index_equal(result, expected)
    msg = 'cannot subtract TimedeltaIndex and DatetimeIndex'
    with tm.assert_raises_regex(TypeError, msg):
        (tdi - dti)
    result = (dti - tdi.values)
    tm.assert_index_equal(result, expected)
    msg = 'cannot perform __neg__ with this index type:'
    with tm.assert_raises_regex(TypeError, msg):
        (tdi.values - dti)
def test_dti_sub_tdi(self, tz):
    dti = DatetimeIndex(([Timestamp('2017-01-01', tz=tz)] * 10))
    tdi = pd.timedelta_range('0 days', periods=10)
    expected = pd.date_range('2017-01-01', periods=10, tz=tz, freq='-1D')
    result = (dti - tdi)
    tm.assert_index_equal(result, expected)
    msg = 'cannot subtract TimedeltaIndex and DatetimeIndex'
    with tm.assert_raises_regex(TypeError, msg):
        (tdi - dti)
    result = (dti - tdi.values)
    tm.assert_index_equal(result, expected)
    msg = 'cannot perform __neg__ with this index type:'
    with tm.assert_raises_regex(TypeError, msg):
        (tdi.values - dti)