<s> from depot . io . local import LocalFileStorage <EOL> import shutil <EOL> import os <EOL> FILE_CONTENT = b'<STR_LIT>' <EOL> class TestLocalFileStorage ( object ) : <EOL> def setup ( self ) : <EOL> self . fs = LocalFileStorage ( '<STR_LIT>' ) <EOL> def teardown ( self ) : <EOL> shutil . rmtree ( '<STR_LIT>' , ignore_errors = True ) <EOL> def test_creation ( self ) : <EOL> file_id = self . fs . create ( FILE_CONTENT , '<STR_LIT>' ) <EOL> assert FILE_CONTENT == open ( os . path . join ( '<STR_LIT>' , file_id , '<STR_LIT:file>' ) , '<STR_LIT:rb>' ) . read ( ) <EOL> def test_corrupted_metadata ( self ) : <EOL> file_id = self . fs . create ( FILE_CONTENT , '<STR_LIT>' ) <EOL> f = self . fs . get ( file_id ) <EOL> with open ( f . _metadata_path , '<STR_LIT:w>' ) as mdf : <EOL> mdf . write ( '<STR_LIT>' ) <EOL> did_detect_corrupted_metadata = False <EOL> try : <EOL> f = self . fs . get ( file_id ) <EOL> except ValueError : <EOL> did_detect_corrupted_metadata = True <EOL> assert did_detect_corrupted_metadata </s>
