def test_format_error(self): ex = exception.UnknownFieldError(what='Template') self.assertEqual( _('An unknown exception occurred.'), ex.__str__(), ) self.assertRaises(KeyError, self._formate_exception)
def _validate_field(self): for name in self.tpl: if name not in SECTIONS: exception.ExceptionCollector.appendException( exception.UnknownFieldError(what='Template', field=name))
def _formate_exception(self): exception.UnknownFieldError.set_fatal_format_exception(True) raise exception.UnknownFieldError(what='Template')