def _handle_assert(self, fname, span, expr):
result = ''
try:
cond = bool(self._evaluate(expr, fname, span[0]))
except Exception as exc:
msg = "exception occured when evaluating assert condition '{0}'"\
.format(expr)
raise FyppFatalError(msg, fname, span, exc)
if not cond:
msg = "Assertion failed ('{0}')".format(expr)
raise FyppStopRequest(msg, fname, span)
if self._linenums and not self._diverted:
result = linenumdir(span[1], fname)
return result
评论列表
文章目录