

def test_diff(self):
    self.ts.diff()
    a = 10000000000000000
    b = (a + 1)
    s = Series([a, b])
    rs = s.diff()
    self.assertEqual(rs[1], 1)
    rs = self.ts.diff((- 1))
    xp = (self.ts - self.ts.shift((- 1)))
    assert_series_equal(rs, xp)
    rs = self.ts.diff(0)
    xp = (self.ts - self.ts)
    assert_series_equal(rs, b)
    s = Series(date_range('20130102', periods=5))
    rs = (s - s.shift(1))
    xp = s.diff()
    assert_series_equal(rs, xp)
    nrs = (rs - rs.shift(1))
    nxp = xp.diff()
    assert_series_equal(nrs, nxp)
    s = Series(date_range('2000-01-01 09:00:00', periods=5, tz='US/Eastern'), name='foo')
    result = s.diff()
    assert_series_equal(result, Series(TimedeltaIndex((['NaT'] + (['1 days'] * 4))), name='foo'))

dataset/ETHPy150Open pydata/pandas/pandas/tests/series/test_timeseries.py TestSeriesTimeSeries.test_diff/VarMisuse@129/138 `xp`->`b`