#NEWLINE# def match( self , v2 ) : #NEWLINE# #INDENT# "Assert two values are equivalent.\n\n        NOTE:\n\n            If you don't care (or don't know) a given value, you can specify\n            the string DONTCARE as the value. This will cause that item\n            to be skipped.\n\n        " #NEWLINE# try : #NEWLINE# #INDENT# error = abs ( ( float ( self . v1 ) - float ( v2 ) ) ) #NEWLINE# within_tolerance = ( error <= within_tolerance . tolerance ) #NEWLINE# #UNINDENT# except ( ValueError , TypeError ) : #NEWLINE# #INDENT# within_tolerance = False #NEWLINE# #UNINDENT# if ( hasattr ( self . v1 , 'keys' ) and hasattr ( v2 , 'keys' ) ) : #NEWLINE# #INDENT# matcher = DictMatches ( self . v1 , self . approx_equal , self . tolerance , self . orderless_lists ) #NEWLINE# did_match = matcher . match ( v2 ) #NEWLINE# if ( did_match is not None ) : #NEWLINE# #INDENT# return did_match #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( self . v1 , list ) and isinstance ( v2 , list ) ) : #NEWLINE# #INDENT# matcher = ListMatches ( self . v1 , self . approx_equal , self . tolerance , self . orderless_lists ) #NEWLINE# did_match = matcher . match ( v2 ) #NEWLINE# if ( did_match is not None ) : #NEWLINE# #INDENT# return did_match #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'DONTCARE' in ( self . v1 , v2 ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . approx_equal and within_tolerance ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . v1 != v2 ) : #NEWLINE# #INDENT# return ValueMismatch ( self . v1 , v2 )