1
1
# pylint: disable-msg=E1101,W0612
2
- from datetime import datetime , time , timedelta , tzinfo , date
2
+ from datetime import datetime , timedelta , tzinfo , date
3
3
import sys
4
4
import os
5
5
import unittest
8
8
import numpy as np
9
9
import pytz
10
10
11
- from pandas import (Index , Series , TimeSeries , DataFrame , isnull ,
12
- date_range , Timestamp )
11
+ from pandas import (Index , Series , DataFrame , isnull , Timestamp )
13
12
14
- from pandas import DatetimeIndex , Int64Index , to_datetime , NaT
13
+ from pandas import DatetimeIndex , to_datetime , NaT
15
14
from pandas import tslib
16
15
17
16
import pandas .core .datetools as datetools
20
19
import pandas .tseries .tools as tools
21
20
from pytz import NonExistentTimeError
22
21
23
- from pandas .util .testing import assert_series_equal , assert_almost_equal , assertRaisesRegexp
24
22
import pandas .util .testing as tm
25
23
26
- import pandas .lib as lib
27
- import pandas .core .datetools as dt
28
- from numpy .random import rand
29
24
from pandas .util .testing import assert_frame_equal
30
- import pandas .compat as compat
31
- from pandas .compat import range , lrange , zip , cPickle as pickle
32
- from pandas .core .datetools import BDay
33
- import pandas .core .common as com
25
+ from pandas .compat import lrange , zip
34
26
35
27
from pandas import _np_version_under1p7
36
28
@@ -544,13 +536,13 @@ def test_localized_at_time_between_time(self):
544
536
545
537
result = ts_local .at_time (time (10 , 0 ))
546
538
expected = ts .at_time (time (10 , 0 )).tz_localize (self .tzstr ('US/Eastern' ))
547
- assert_series_equal (result , expected )
539
+ tm . assert_series_equal (result , expected )
548
540
self .assertTrue (self .cmptz (result .index .tz , self .tz ('US/Eastern' )))
549
541
550
542
t1 , t2 = time (10 , 0 ), time (11 , 0 )
551
543
result = ts_local .between_time (t1 , t2 )
552
544
expected = ts .between_time (t1 , t2 ).tz_localize (self .tzstr ('US/Eastern' ))
553
- assert_series_equal (result , expected )
545
+ tm . assert_series_equal (result , expected )
554
546
self .assertTrue (self .cmptz (result .index .tz , self .tz ('US/Eastern' )))
555
547
556
548
def test_string_index_alias_tz_aware (self ):
@@ -631,7 +623,7 @@ def test_frame_no_datetime64_dtype(self):
631
623
'datetimes_with_tz' : datetimes_with_tz })
632
624
result = df .get_dtype_counts ()
633
625
expected = Series ({ 'datetime64[ns]' : 3 , 'object' : 1 })
634
- assert_series_equal (result , expected )
626
+ tm . assert_series_equal (result , expected )
635
627
636
628
def test_hongkong_tz_convert (self ):
637
629
# #1673
@@ -863,7 +855,7 @@ def test_series_frame_tz_localize(self):
863
855
# Can't localize if already tz-aware
864
856
rng = date_range ('1/1/2011' , periods = 100 , freq = 'H' , tz = 'utc' )
865
857
ts = Series (1 , index = rng )
866
- assertRaisesRegexp (TypeError , 'Already tz-aware' , ts .tz_localize , 'US/Eastern' )
858
+ tm . assertRaisesRegexp (TypeError , 'Already tz-aware' , ts .tz_localize , 'US/Eastern' )
867
859
868
860
def test_series_frame_tz_convert (self ):
869
861
rng = date_range ('1/1/2011' , periods = 200 , freq = 'D' ,
@@ -887,7 +879,7 @@ def test_series_frame_tz_convert(self):
887
879
# can't convert tz-naive
888
880
rng = date_range ('1/1/2011' , periods = 200 , freq = 'D' )
889
881
ts = Series (1 , index = rng )
890
- assertRaisesRegexp (TypeError , "Cannot convert tz-naive" , ts .tz_convert , 'US/Eastern' )
882
+ tm . assertRaisesRegexp (TypeError , "Cannot convert tz-naive" , ts .tz_convert , 'US/Eastern' )
891
883
892
884
def test_join_utc_convert (self ):
893
885
rng = date_range ('1/1/2011' , periods = 100 , freq = 'H' , tz = 'utc' )
@@ -1033,7 +1025,7 @@ def test_arith_utc_convert(self):
1033
1025
expected = uts1 + uts2
1034
1026
1035
1027
self .assertEqual (result .index .tz , pytz .UTC )
1036
- assert_series_equal (result , expected )
1028
+ tm . assert_series_equal (result , expected )
1037
1029
1038
1030
def test_intersection (self ):
1039
1031
rng = date_range ('1/1/2011' , periods = 100 , freq = 'H' , tz = 'utc' )
0 commit comments