#NEWLINE# def test_frame_allowance( self ) : #NEWLINE# #INDENT# frames = [ ] #NEWLINE# for x in range ( 10 ) : #NEWLINE# #INDENT# frame = Mock ( ) #NEWLINE# frame . f_locals = { #NEWLINE# #INDENT# 'k' : 'v' , #NEWLINE# #UNINDENT# } #NEWLINE# frame . f_lineno = None #NEWLINE# frame . f_globals = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# frame . f_code . co_filename = str ( x ) #NEWLINE# frame . f_code . co_name = __name__ #NEWLINE# frames . append ( ( frame , 1 ) ) #NEWLINE# #UNINDENT# results = get_stack_info ( frames , frame_allowance = 4 ) #NEWLINE# assert ( len ( results [ 'frames' ] ) == 10 ) #NEWLINE# assert ( results [ 'frames' ] [ 0 ] [ 'filename' ] == '0' ) #NEWLINE# assert ( results [ 'frames' ] [ 1 ] [ 'filename' ] == '1' ) #NEWLINE# for ( idx , frame ) in enumerate ( results [ 'frames' ] [ 2 : 8 ] ) : #NEWLINE# #INDENT# assert ( frame [ 'filename' ] == str ( ( idx + 2 ) ) ) #NEWLINE# assert ( 'vars' not in frame ) #NEWLINE# #UNINDENT# assert ( results [ 'frames' ] [ 8 ] [ 'filename' ] == '8' ) #NEWLINE# assert ( results [ 'frames' ] [ 9 ] [ 'filename' ] == '9' )