From 9f2bce000158dbb7dfd3c9fa2c9a0e2837ee6e01 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 14 May 2012 19:22:09 -0400 Subject: [PATCH] Catch common case where problem answers are specified with units but don't expect them in the input --- common/lib/capa/checker.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/lib/capa/checker.py b/common/lib/capa/checker.py index a4f4b8683f..81c46677b3 100755 --- a/common/lib/capa/checker.py +++ b/common/lib/capa/checker.py @@ -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))