@@ -25,7 +25,10 @@ def test_shift(self):
25
25
shifted = self .ts .shift (1 )
26
26
unshifted = shifted .shift (- 1 )
27
27
28
- tm .assert_dict_equal (unshifted .valid (), self .ts , compare_keys = False )
28
+ tm .assert_index_equal (shifted .index , self .ts .index )
29
+ tm .assert_index_equal (unshifted .index , self .ts .index )
30
+ tm .assert_numpy_array_equal (unshifted .valid ().values ,
31
+ self .ts .values [:- 1 ])
29
32
30
33
offset = datetools .bday
31
34
shifted = self .ts .shift (1 , freq = offset )
@@ -49,7 +52,9 @@ def test_shift(self):
49
52
ps = tm .makePeriodSeries ()
50
53
shifted = ps .shift (1 )
51
54
unshifted = shifted .shift (- 1 )
52
- tm .assert_dict_equal (unshifted .valid (), ps , compare_keys = False )
55
+ tm .assert_index_equal (shifted .index , ps .index )
56
+ tm .assert_index_equal (unshifted .index , ps .index )
57
+ tm .assert_numpy_array_equal (unshifted .valid ().values , ps .values [:- 1 ])
53
58
54
59
shifted2 = ps .shift (1 , 'B' )
55
60
shifted3 = ps .shift (1 , datetools .bday )
@@ -77,16 +82,16 @@ def test_shift(self):
77
82
78
83
# xref 8260
79
84
# with tz
80
- s = Series (
81
- date_range ('2000-01-01 09:00:00' , periods = 5 ,
82
- tz = 'US/Eastern' ), name = 'foo' )
85
+ s = Series (date_range ('2000-01-01 09:00:00' , periods = 5 ,
86
+ tz = 'US/Eastern' ), name = 'foo' )
83
87
result = s - s .shift ()
84
- assert_series_equal (result , Series (
85
- TimedeltaIndex (['NaT' ] + ['1 days' ] * 4 ), name = 'foo' ))
88
+
89
+ exp = Series (TimedeltaIndex (['NaT' ] + ['1 days' ] * 4 ), name = 'foo' )
90
+ assert_series_equal (result , exp )
86
91
87
92
# incompat tz
88
- s2 = Series (
89
- date_range ( '2000-01-01 09:00:00' , periods = 5 , tz = 'CET' ), name = 'foo' )
93
+ s2 = Series (date_range ( '2000-01-01 09:00:00' , periods = 5 ,
94
+ tz = 'CET' ), name = 'foo' )
90
95
self .assertRaises (ValueError , lambda : s - s2 )
91
96
92
97
def test_tshift (self ):
0 commit comments