def test_file_not_found(self): """Validation: test when a file is not found.""" from natcap.invest import validation filepath = os.path.join(self.workspace_dir, 'file.txt') error_msg = validation.check_file(filepath) self.assertTrue('File not found' in error_msg)
def test_file_exists(self): """Validation: test that a file exists.""" from natcap.invest import validation filepath = os.path.join(self.workspace_dir, 'file.txt') with open(filepath, 'w') as new_file: new_file.write("Here's some text.") self.assertEqual(None, validation.check_file(filepath))