#NEWLINE# def test_take( self ) : #NEWLINE# #INDENT# idx1 = pd . timedelta_range ( '1 day' , '31 day' , freq = 'D' , name = 'idx' ) #NEWLINE# for idx in [ idx1 ] : #NEWLINE# #INDENT# result = idx . take ( [ 0 ] ) #NEWLINE# self . assertEqual ( result , pd . Timedelta ( '1 day' ) ) #NEWLINE# result = idx . take ( [ ( - 1 ) ] ) #NEWLINE# self . assertEqual ( result , pd . Timedelta ( '31 day' ) ) #NEWLINE# result = idx . take ( [ 0 , 1 , 2 ] ) #NEWLINE# expected = pd . timedelta_range ( '1 day' , '3 day' , freq = 'D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# result = idx . take ( [ 0 , 2 , 4 ] ) #NEWLINE# expected = pd . timedelta_range ( '1 day' , '5 day' , freq = '2D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# result = idx . take ( [ 7 , 4 , 1 ] ) #NEWLINE# expected = pd . timedelta_range ( '8 day' , '2 day' , freq = '-3D' , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . freq , expected . freq ) #NEWLINE# result = idx . take ( [ 3 , 2 , 5 ] ) #NEWLINE# expected = TimedeltaIndex ( [ '4 day' , '3 day' , '6 day' ] , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertIsNone ( result . freq ) #NEWLINE# result = idx . take ( [ ( - 3 ) , 2 , 5 ] ) #NEWLINE# expected = TimedeltaIndex ( [ '29 day' , '3 day' , '6 day' ] , name = 'idx' ) #NEWLINE# self . assert_index_equal ( result , expected ) #NEWLINE# self . assertIsNone ( result . freq )