#NEWLINE# def test_astype_str( self ) : #NEWLINE# #INDENT# result = date_range ( '2012-01-01' , periods = 4 , name = 'test_name' ) . astype ( str ) #NEWLINE# expected = Index ( [ '2012-01-01' , '2012-01-02' , '2012-01-03' , '2012-01-04' ] , name = 'test_name' , dtype = object ) #NEWLINE# tm . assert_index_equal ( result , expected ) #NEWLINE# result = date_range ( '2012-01-01' , periods = 3 , name = 'test_name' , tz = 'US/Eastern' ) . astype ( str ) #NEWLINE# expected = Index ( [ '2012-01-01 00:00:00-05:00' , '2012-01-02 00:00:00-05:00' , '2012-01-03 00:00:00-05:00' ] , name = 'test_name' , dtype = object ) #NEWLINE# tm . assert_index_equal ( result , expected ) #NEWLINE# result = date_range ( '1/1/2011' , periods = 3 , freq = 'H' , name = 'test_name' ) . astype ( str ) #NEWLINE# expected = Index ( [ '2011-01-01 00:00:00' , '2011-01-01 01:00:00' , '2011-01-01 02:00:00' ] , name = 'test_name' , dtype = object ) #NEWLINE# tm . assert_index_equal ( result , expected ) #NEWLINE# result = date_range ( '3/6/2012 00:00' , periods = 2 , freq = 'H' , tz = 'Europe/London' , name = 'test_name' ) . astype ( str ) #NEWLINE# expected = Index ( [ '2012-03-06 00:00:00+00:00' , '2012-03-06 01:00:00+00:00' ] , dtype = object , name = 'test_name' ) #NEWLINE# tm . assert_index_equal ( result , expected )