def test_file_md5( self ): example_file = "abc\nabc\n" with patch( 'vasppy.utils.md5sum' ) as mock_md5sum: mock_md5sum.return_value = 'foo' with patch( 'vasppy.utils.zopen', mock_open( read_data=example_file ), create=True ) as m: self.assertEqual( file_md5( m ), 'foo' ) mock_md5sum.assert_called_with( example_file )
def test_file_md5(self): example_file = "abc\nabc\n" with patch('vasppy.utils.md5sum') as mock_md5sum: mock_md5sum.return_value = 'foo' with patch('vasppy.utils.zopen', mock_open(read_data=example_file), create=True) as m: self.assertEqual(file_md5(m), 'foo') mock_md5sum.assert_called_with(example_file)
def print_file_tracking(self): if self.meta.track: print("file tracking:") for f, new_filename in self.meta.track.items(): print(" {}:".format(f)) if not new_filename: new_filename = f print(" filename: {}".format(new_filename)) filename = match_filename(self.directory + f) if filename: md5 = file_md5(filename) else: md5 = 'null' print(" md5: {}".format(md5))
def print_file_tracking( self ): if self.meta.track: print( "file tracking:" ) for f, new_filename in self.meta.track.items(): print( " {}:".format( f ) ) if not new_filename: new_filename = f print( " filename: {}".format( new_filename ) ) filename = match_filename( self.directory + f ) if filename: md5 = file_md5( filename ) else: md5 = 'null' print( " md5: {}".format( md5 ) )
def print_vasprun_md5(self): print("vasprun md5: {}".format( file_md5("{}/{}".format(self.directory, self.vasprun_filename))))
def print_vasprun_md5( self ): print( "vasprun md5: {}".format( file_md5( "{}/{}".format( self.directory, self.vasprun_filename ) ) ) )