#NEWLINE# def test_construction_index_with_mixed_timezones_with_NaT( self ) : #NEWLINE# #INDENT# result = Index ( [ pd . NaT , Timestamp ( '2011-01-01' ) , pd . NaT , Timestamp ( '2011-01-02' ) ] , name = 'idx' ) #NEWLINE# exp = DatetimeIndex ( [ pd . NaT , Timestamp ( '2011-01-01' ) , pd . NaT , Timestamp ( '2011-01-02' ) ] , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertTrue ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# self . assertIsNone ( result . tz ) #NEWLINE# result = Index ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' , tz = 'Asia/Tokyo' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' , tz = 'Asia/Tokyo' ) ] , name = 'idx' ) #NEWLINE# exp = DatetimeIndex ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' ) ] , tz = 'Asia/Tokyo' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertTrue ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# self . assertIsNotNone ( result . tz ) #NEWLINE# self . assertEqual ( result . tz , exp . tz ) #NEWLINE# result = Index ( [ Timestamp ( '2011-01-01 10:00' , tz = 'US/Eastern' ) , pd . NaT , Timestamp ( '2011-08-01 10:00' , tz = 'US/Eastern' ) ] , name = 'idx' ) #NEWLINE# exp = DatetimeIndex ( [ Timestamp ( '2011-01-01 10:00' ) , pd . NaT , Timestamp ( '2011-08-01 10:00' ) ] , tz = 'US/Eastern' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertTrue ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# self . assertIsNotNone ( result . tz ) #NEWLINE# self . assertEqual ( result . tz , exp . tz ) #NEWLINE# result = Index ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' , tz = 'US/Eastern' ) ] , name = 'idx' ) #NEWLINE# exp = Index ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' , tz = 'US/Eastern' ) ] , dtype = 'object' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertFalse ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# result = Index ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' , tz = 'Asia/Tokyo' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' , tz = 'US/Eastern' ) ] , name = 'idx' ) #NEWLINE# exp = Index ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' , tz = 'Asia/Tokyo' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' , tz = 'US/Eastern' ) ] , dtype = 'object' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertFalse ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# result = Index ( [ pd . NaT , Timestamp ( '2011-01-01 10:00' ) , pd . NaT , Timestamp ( '2011-01-02 10:00' , tz = 'US/Eastern' ) ] , tz = 'Asia/Tokyo' , name = 'idx' ) #NEWLINE# exp = DatetimeIndex ( [ pd . NaT , Timestamp ( '2011-01-01 19:00' ) , pd . NaT , Timestamp ( '2011-01-03 00:00' ) ] , tz = 'Asia/Tokyo' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertTrue ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# result = Index ( [ pd . NaT , pd . NaT ] , name = 'idx' ) #NEWLINE# exp = DatetimeIndex ( [ pd . NaT , pd . NaT ] , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , exp , exact = True ) #NEWLINE# self . assertTrue ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# self . assertIsNone ( result . tz ) #NEWLINE# result = Index ( [ pd . NaT , pd . NaT ] , tz = 'Asia/Tokyo' , name = 'idx' ) #NEWLINE# exp = DatetimeIndex ( [ pd . NaT , pd . NaT ] , tz = 'Asia/Tokyo' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , result , exact = True ) #NEWLINE# self . assertTrue ( isinstance ( result , DatetimeIndex ) ) #NEWLINE# self . assertIsNotNone ( result . tz ) #NEWLINE# self . assertEqual ( result . tz , exp . tz )