<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import numpy . testing as npt <EOL> import pandas as pd <EOL> def assert_frames_equal ( actual , expected , use_close = False ) : <EOL> """<STR_LIT>""" <EOL> if use_close : <EOL> comp = npt . assert_allclose <EOL> else : <EOL> comp = npt . assert_equal <EOL> assert ( isinstance ( actual , pd . DataFrame ) and <EOL> isinstance ( expected , pd . DataFrame ) ) , '<STR_LIT>' <EOL> for i , exp_row in expected . iterrows ( ) : <EOL> assert i in actual . index , '<STR_LIT>' . format ( i ) <EOL> act_row = actual . loc [ i ] <EOL> for j , exp_item in exp_row . iteritems ( ) : <EOL> assert j in act_row . index , '<STR_LIT>' . format ( j ) <EOL> act_item = act_row [ j ] <EOL> try : <EOL> comp ( act_item , exp_item ) <EOL> except AssertionError as e : <EOL> raise AssertionError ( <EOL> e . message + '<STR_LIT>' . format ( j , i ) ) <EOL> def assert_index_equal ( left , right ) : <EOL> """<STR_LIT>""" <EOL> assert isinstance ( left , pd . Index ) <EOL> assert isinstance ( right , pd . Index ) <EOL> left_diff = left . diff ( right ) <EOL> right_diff = right . diff ( left ) <EOL> if len ( left_diff ) > <NUM_LIT:0> or len ( right_diff ) > <NUM_LIT:0> : <EOL> raise AssertionError ( "<STR_LIT>" . format ( <EOL> left_diff , right_diff ) ) </s>
