#NEWLINE# def test_asobject_tolist( self ) : #NEWLINE# #INDENT# idx = timedelta_range ( start = '1 days' , periods = 4 , freq = 'D' , name = 'idx' ) #NEWLINE# expected_list = [ Timedelta ( '1 days' ) , Timedelta ( '2 days' ) , Timedelta ( '3 days' ) , Timedelta ( '4 days' ) ] #NEWLINE# expected = pd . Index ( expected_list , dtype = object , name = 'idx' ) #NEWLINE# result = idx . asobject #NEWLINE# self . assertTrue ( isinstance ( result , Index ) ) #NEWLINE# self . assertEqual ( result . dtype , object ) #NEWLINE# self . assertTrue ( result . equals ( expected ) ) #NEWLINE# self . assertEqual ( result . name , expected . name ) #NEWLINE# self . assertEqual ( idx . tolist ( ) , expected_list ) #NEWLINE# idx = TimedeltaIndex ( [ timedelta ( days = 1 ) , timedelta ( days = 2 ) , pd . NaT , timedelta ( days = 4 ) ] , name = 'idx' ) #NEWLINE# expected_list = [ Timedelta ( '1 days' ) , Timedelta ( '2 days' ) , pd . NaT , Timedelta ( '4 days' ) ] #NEWLINE# expected = pd . Index ( expected_list , dtype = object , name = 'idx' ) #NEWLINE# result = idx . asobject #NEWLINE# self . assertTrue ( isinstance ( result , Index ) ) #NEWLINE# self . assertEqual ( result . dtype , object ) #NEWLINE# self . assertTrue ( result . equals ( expected ) ) #NEWLINE# self . assertEqual ( result . name , expected . name ) #NEWLINE# self . assertEqual ( idx . tolist ( ) , expected_list )