#NEWLINE# def test_truncate( self ) : #NEWLINE# #INDENT# ts = self . tsframe [ : : 3 ] #NEWLINE# ( start , end ) = ( self . tsframe . index [ 3 ] , self . tsframe . index [ 6 ] ) #NEWLINE# start_missing = self . tsframe . index [ 2 ] #NEWLINE# end_missing = self . tsframe . index [ 7 ] #NEWLINE# truncated = ts . truncate ( ) #NEWLINE# assert_frame_equal ( truncated , ts ) #NEWLINE# expected = ts [ 1 : 3 ] #NEWLINE# truncated = ts . truncate ( start , end ) #NEWLINE# assert_frame_equal ( truncated , expected ) #NEWLINE# truncated = ts . truncate ( start_missing , end_missing ) #NEWLINE# assert_frame_equal ( truncated , expected ) #NEWLINE# expected = ts [ 1 : ] #NEWLINE# truncated = ts . truncate ( before = start ) #NEWLINE# assert_frame_equal ( truncated , expected ) #NEWLINE# truncated = ts . truncate ( before = start_missing ) #NEWLINE# assert_frame_equal ( truncated , expected ) #NEWLINE# expected = ts [ : 3 ] #NEWLINE# truncated = ts . truncate ( after = end ) #NEWLINE# assert_frame_equal ( truncated , expected ) #NEWLINE# truncated = ts . truncate ( after = end_missing ) #NEWLINE# assert_frame_equal ( truncated , expected ) #NEWLINE# self . assertRaises ( ValueError , ts . truncate , before = ( start . index [ ( - 1 ) ] - 1 ) , after = ( ts . index [ 0 ] + 1 ) )