#NEWLINE# def test_hash_consistency( ) : #NEWLINE# #INDENT# for reverse in ( False , True ) : #NEWLINE# #INDENT# with temporary_content ( CONTENT ) as td : #NEWLINE# #INDENT# dir_hash = CacheHelper . dir_hash ( td ) #NEWLINE# with named_temporary_file ( ) as tf : #NEWLINE# #INDENT# write_zipfile ( td , tf . name , reverse = reverse ) #NEWLINE# with contextlib . closing ( zipfile . ZipFile ( reverse . name , 'r' ) ) as zf : #NEWLINE# #INDENT# zip_hash = CacheHelper . zip_hash ( zf ) #NEWLINE# assert ( zip_hash == dir_hash ) #NEWLINE# assert ( zip_hash != sha1 ( ) . hexdigest ( ) )