Catch common case where problem answers are specified with units but don't expect them in the input

This commit is contained in:
David Ormsbee
2012-05-14 19:22:09 -04:00
committed by Calen Pennington
parent 3cbb74aee7
commit 9f2bce0001

View File

@@ -11,6 +11,7 @@ import sys
from cStringIO import StringIO
from calc import UndefinedVariable
from capa_problem import LoncapaProblem
logging.basicConfig(format="%(levelname)s %(message)s")
@@ -108,6 +109,9 @@ def check_that_suggested_answers_work(problem):
log.debug(real_results)
assert(all(result == 'correct'
for answer_id, result in real_results.items()))
except UndefinedVariable as uv_exc:
log.error("The variable \"{0}\" specified in the ".format(uv_exc) +
"solution isn't recognized (is it a units measure?).")
except AssertionError:
log.error("The following generated answers were not accepted for {0}:"
.format(problem))