diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 9332417197..f9cfa0281c 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -1597,9 +1597,8 @@ class NumericalResponse(LoncapaResponse): student_float = evaluator({}, {}, student_answer) except UndefinedVariable as undef_var: raise StudentInputError( - _(u"You may not use variables ({bad_variables}) in numerical problems.").format( - bad_variables=undef_var.message, - ) + _(u"Answers can include numerals, operation signs, and a few specific characters, " + u"such as the constants e and i.") ) except ValueError as val_err: if 'factorial' in val_err.message: @@ -1608,7 +1607,7 @@ class NumericalResponse(LoncapaResponse): # ve.message will be: `factorial() only accepts integral values` or # `factorial() not defined for negative values` raise StudentInputError( - _("factorial function evaluated outside its domain:" + _("Factorial function evaluated outside its domain:" "'{student_answer}'").format(student_answer=cgi.escape(student_answer)) ) else: @@ -3104,7 +3103,8 @@ class FormulaResponse(LoncapaResponse): cgi.escape(answer) ) raise StudentInputError( - _("Invalid input: {bad_input} not permitted in answer.").format(bad_input=err.message) + _(u"Answers can include numerals, operation signs, and a few specific characters, " + u"such as the constants e and i.") ) except ValueError as err: if 'factorial' in err.message: @@ -3119,7 +3119,7 @@ class FormulaResponse(LoncapaResponse): cgi.escape(answer) ) raise StudentInputError( - _("factorial function not permitted in answer " + _("Factorial function not permitted in answer " "for this problem. Provided answer was: " "{bad_input}").format(bad_input=cgi.escape(answer)) ) diff --git a/common/lib/capa/capa/tests/test_responsetypes.py b/common/lib/capa/capa/tests/test_responsetypes.py index 982924eb61..79f5eeebbb 100644 --- a/common/lib/capa/capa/tests/test_responsetypes.py +++ b/common/lib/capa/capa/tests/test_responsetypes.py @@ -1669,8 +1669,9 @@ class NumericalResponseTest(ResponseTest): # pylint: disable=missing-docstring problem = self.build_problem(answer=4) errors = [ # (exception raised, message to student) - (calc.UndefinedVariable("x"), r"You may not use variables \(x\) in numerical problems"), - (ValueError("factorial() mess-up"), "factorial function evaluated outside its domain"), + (calc.UndefinedVariable("x"), "Answers can include numerals, operation signs, " + "and a few specific characters, such as the constants e and i."), + (ValueError("factorial() mess-up"), "Factorial function evaluated outside its domain"), (ValueError(), "Could not interpret '.*' as a number"), (pyparsing.ParseException("oopsie"), "Invalid math syntax"), (ZeroDivisionError(), "Could not interpret '.*' as a number") diff --git a/common/lib/xmodule/xmodule/capa_base.py b/common/lib/xmodule/xmodule/capa_base.py index f778316bfb..f860023a4e 100644 --- a/common/lib/xmodule/xmodule/capa_base.py +++ b/common/lib/xmodule/xmodule/capa_base.py @@ -1238,7 +1238,7 @@ class CapaMixin(CapaFields): # without a stack trace else: # Translators: {msg} will be replaced with a problem's error message. - msg = _(u"Error: {msg}").format(msg=inst.message) + msg = inst.message return {'success': msg} diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index 54bd748c38..30a9a90406 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -1104,7 +1104,7 @@ div.problem { .notification-message { display: inline-block; - width: flex-grid(6,10); + width: flex-grid(7,10); // Make notification tall enough that when the "Review" button is displayed, // the notification does not grow in height. margin-bottom: 8px; diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py index 73b716de68..c79b7d16f6 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -818,7 +818,8 @@ class CapaModuleTest(unittest.TestCase): result = module.submit_problem(get_request_dict) # Expect an AJAX alert message in 'success' - expected_msg = 'Error: test error' + expected_msg = 'test error' + self.assertEqual(expected_msg, result['success']) # Expect that the number of attempts is NOT incremented @@ -886,7 +887,8 @@ class CapaModuleTest(unittest.TestCase): result = module.submit_problem(get_request_dict) # Expect an AJAX alert message in 'success' - expected_msg = u'Error: ȧƈƈḗƞŧḗḓ ŧḗẋŧ ƒǿř ŧḗşŧīƞɠ' + expected_msg = u'ȧƈƈḗƞŧḗḓ ŧḗẋŧ ƒǿř ŧḗşŧīƞɠ' + self.assertEqual(expected_msg, result['success']) # Expect that the number of attempts is NOT incremented