7
7
8
8
from pandas import Index , Series , date_range , NaT
9
9
from pandas .tseries .index import DatetimeIndex
10
+ from pandas .tseries .offsets import BDay , BMonthEnd
10
11
from pandas .tseries .tdi import TimedeltaIndex
11
12
12
- import pandas .core .datetools as datetools
13
-
14
13
from pandas .util .testing import assert_series_equal , assert_almost_equal
15
14
import pandas .util .testing as tm
16
15
17
- from .common import TestData
16
+ from pandas . tests . series .common import TestData
18
17
19
18
20
19
class TestSeriesTimeSeries (TestData , tm .TestCase ):
@@ -29,7 +28,7 @@ def test_shift(self):
29
28
tm .assert_numpy_array_equal (unshifted .valid ().values ,
30
29
self .ts .values [:- 1 ])
31
30
32
- offset = datetools . bday
31
+ offset = BDay ()
33
32
shifted = self .ts .shift (1 , freq = offset )
34
33
unshifted = shifted .shift (- 1 , freq = offset )
35
34
@@ -56,7 +55,7 @@ def test_shift(self):
56
55
tm .assert_numpy_array_equal (unshifted .valid ().values , ps .values [:- 1 ])
57
56
58
57
shifted2 = ps .shift (1 , 'B' )
59
- shifted3 = ps .shift (1 , datetools . bday )
58
+ shifted3 = ps .shift (1 , BDay () )
60
59
assert_series_equal (shifted2 , shifted3 )
61
60
assert_series_equal (ps , shifted2 .shift (- 1 , 'B' ))
62
61
@@ -66,7 +65,7 @@ def test_shift(self):
66
65
shifted4 = ps .shift (1 , freq = 'B' )
67
66
assert_series_equal (shifted2 , shifted4 )
68
67
69
- shifted5 = ps .shift (1 , freq = datetools . bday )
68
+ shifted5 = ps .shift (1 , freq = BDay () )
70
69
assert_series_equal (shifted5 , shifted4 )
71
70
72
71
# 32-bit taking
@@ -131,7 +130,7 @@ def test_tshift(self):
131
130
shifted2 = ps .tshift (freq = 'B' )
132
131
assert_series_equal (shifted , shifted2 )
133
132
134
- shifted3 = ps .tshift (freq = datetools . bday )
133
+ shifted3 = ps .tshift (freq = BDay () )
135
134
assert_series_equal (shifted , shifted3 )
136
135
137
136
self .assertRaises (ValueError , ps .tshift , freq = 'M' )
@@ -156,7 +155,7 @@ def test_tshift(self):
156
155
self .assertRaises (ValueError , no_freq .tshift )
157
156
158
157
def test_truncate (self ):
159
- offset = datetools . bday
158
+ offset = BDay ()
160
159
161
160
ts = self .ts [::3 ]
162
161
@@ -417,8 +416,8 @@ def test_asfreq(self):
417
416
monthly_ts = daily_ts .asfreq ('BM' )
418
417
self .assert_series_equal (monthly_ts , ts )
419
418
420
- daily_ts = ts .asfreq (datetools . bday )
421
- monthly_ts = daily_ts .asfreq (datetools . bmonthEnd )
419
+ daily_ts = ts .asfreq (BDay () )
420
+ monthly_ts = daily_ts .asfreq (BMonthEnd () )
422
421
self .assert_series_equal (monthly_ts , ts )
423
422
424
423
result = ts [:0 ].asfreq ('M' )
@@ -561,3 +560,9 @@ def test_empty_series_ops(self):
561
560
assert_series_equal (a , a - b )
562
561
assert_series_equal (a , b + a )
563
562
self .assertRaises (TypeError , lambda x , y : x - y , b , a )
563
+
564
+
565
+ if __name__ == '__main__' :
566
+ import nose
567
+ nose .runmodule (argv = [__file__ , '-vvs' , '-x' , '--pdb' , '--pdb-failure' ],
568
+ exit = False )
0 commit comments