#NEWLINE# def test_checkmd5( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# rootdir = tempfile . mkdtemp ( ) #NEWLINE# src_file = os . path . join ( rootdir , 'testfile' ) #NEWLINE# realmd5 = 'acbd18db4cc2f85cedef654fccc4a4d8' #NEWLINE# with open ( src_file , 'w' ) as fhand : #NEWLINE# #INDENT# fhand . write ( 'foo' ) #NEWLINE# #UNINDENT# ( result , hexdig ) = checkmd5 ( src_file , 'hello' ) #NEWLINE# self . assertFalse ( result ) #NEWLINE# self . assertEqual ( realmd5 , hexdig ) #NEWLINE# ( result , hexdig ) = checkmd5 ( src_file , realmd5 ) #NEWLINE# self . assertTrue ( result ) #NEWLINE# self . assertEqual ( realmd5 , hexdig ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# shutil . rmtree ( rootdir )