#NEWLINE# def test_memory_usage( self ) : #NEWLINE# #INDENT# for o in self . objs : #NEWLINE# #INDENT# res = o . memory_usage ( ) #NEWLINE# res_deep = o . memory_usage ( deep = True ) #NEWLINE# if ( com . is_object_dtype ( o ) or ( isinstance ( o , Series ) and com . is_object_dtype ( o . index ) ) ) : #NEWLINE# #INDENT# self . assertTrue ( ( res_deep > res ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertEqual ( res , res_deep ) #NEWLINE# #UNINDENT# if isinstance ( o , Series ) : #NEWLINE# #INDENT# self . assertEqual ( ( o . memory_usage ( index = False ) + o . index . memory_usage ( ) ) , o . memory_usage ( index = True ) ) #NEWLINE# #UNINDENT# diff = ( res_deep - sys . getsizeof ( o ) ) #NEWLINE# self . assertTrue ( ( abs ( res_deep ) < 100 ) )