Commit 862ce67b by Will Daly

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.
parent ff35d3e6
...@@ -215,7 +215,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None ...@@ -215,7 +215,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
fans = None fans = None
# do a numerical comparison if both expected and answer are numbers # 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): and hasattr(fans, 'is_number') and fans.is_number):
if abs(abs(fans - fexpect) / fexpect) < threshold: if abs(abs(fans - fexpect) / fexpect) < threshold:
return {'ok': True, 'msg': msg} return {'ok': True, 'msg': msg}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment