<s> from backupdb . utils . exceptions import RestoreError <EOL> from backupdb . utils . files import get_latest_timestamped_file <EOL> from backupdb . tests . utils import FileSystemScratchTestCase <EOL> class GetLatestTimestampedFileTestCase ( FileSystemScratchTestCase ) : <EOL> def create_files ( self , * args ) : <EOL> for file in args : <EOL> open ( self . get_path ( file ) , '<STR_LIT:a>' ) . close ( ) <EOL> def test_it_returns_the_latest_timestamped_file_with_ext ( self ) : <EOL> self . create_files ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> sqlite_file = get_latest_timestamped_file ( '<STR_LIT>' , dir = self . SCRATCH_DIR ) <EOL> mysql_file = get_latest_timestamped_file ( '<STR_LIT>' , dir = self . SCRATCH_DIR ) <EOL> pgsql_file = get_latest_timestamped_file ( '<STR_LIT>' , dir = self . SCRATCH_DIR ) <EOL> self . assertEqual ( sqlite_file , self . get_path ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( mysql_file , self . get_path ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( pgsql_file , self . get_path ( '<STR_LIT>' ) ) <EOL> def test_it_raises_an_exception_when_no_files_found ( self ) : <EOL> self . assertRaises ( RestoreError , get_latest_timestamped_file , '<STR_LIT>' , dir = self . SCRATCH_DIR ) <EOL> self . assertRaises ( RestoreError , get_latest_timestamped_file , '<STR_LIT>' , dir = self . SCRATCH_DIR ) </s>
