From 862ce67bfc59dad908b2445161192aa3d4e080d5 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Mon, 25 Feb 2013 10:59:33 -0500 Subject: [PATCH] Fixed a bug in symmath_check(): one of the if statements evaluated bool(ans), which is False when ans=0. This led to an error message "[symmath_check] failed to get MathML for input; dynamath=[None]" when the function reached a later condition. The check that evaluated bool(ans) was redundant, so I removed it. --- lms/lib/symmath/symmath_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/lib/symmath/symmath_check.py b/lms/lib/symmath/symmath_check.py index d386ea6b06..611948d030 100644 --- a/lms/lib/symmath/symmath_check.py +++ b/lms/lib/symmath/symmath_check.py @@ -215,7 +215,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None fans = None # do a numerical comparison if both expected and answer are numbers - if (hasattr(fexpect, 'is_number') and fexpect.is_number and fans + if (hasattr(fexpect, 'is_number') and fexpect.is_number and hasattr(fans, 'is_number') and fans.is_number): if abs(abs(fans - fexpect) / fexpect) < threshold: return {'ok': True, 'msg': msg}