Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4e3ed8b5
Commit
4e3ed8b5
authored
Jul 18, 2017
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore more specific error messages.
EDUCATOR-929
parent
dfca1fa2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
common/lib/capa/capa/responsetypes.py
+4
-4
common/lib/capa/capa/tests/test_responsetypes.py
+1
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
4e3ed8b5
...
...
@@ -1602,8 +1602,9 @@ class NumericalResponse(LoncapaResponse):
student_float
=
evaluator
({},
{},
student_answer
)
except
UndefinedVariable
as
undef_var
:
raise
StudentInputError
(
_
(
u"Answers can include numerals, operation signs, and a few specific characters, "
u"such as the constants e and i."
)
_
(
u"You may not use variables ({bad_variables}) in numerical problems."
)
.
format
(
bad_variables
=
undef_var
.
message
,
)
)
except
ValueError
as
val_err
:
if
'factorial'
in
val_err
.
message
:
...
...
@@ -3108,8 +3109,7 @@ class FormulaResponse(LoncapaResponse):
cgi
.
escape
(
answer
)
)
raise
StudentInputError
(
_
(
u"Answers can include numerals, operation signs, and a few specific characters, "
u"such as the constants e and i."
)
_
(
"Invalid input: {bad_input} not permitted in answer."
)
.
format
(
bad_input
=
err
.
message
)
)
except
ValueError
as
err
:
if
'factorial'
in
err
.
message
:
...
...
common/lib/capa/capa/tests/test_responsetypes.py
View file @
4e3ed8b5
...
...
@@ -1669,8 +1669,7 @@ class NumericalResponseTest(ResponseTest): # pylint: disable=missing-docstring
problem
=
self
.
build_problem
(
answer
=
4
)
errors
=
[
# (exception raised, message to student)
(
calc
.
UndefinedVariable
(
"x"
),
"Answers can include numerals, operation signs, "
"and a few specific characters, such as the constants e and i."
),
(
calc
.
UndefinedVariable
(
"x"
),
r"You may not use variables \(x\) in numerical problems"
),
(
ValueError
(
"factorial() mess-up"
),
"Factorial function evaluated outside its domain"
),
(
ValueError
(),
"Could not interpret '.*' as a number"
),
(
pyparsing
.
ParseException
(
"oopsie"
),
"Invalid math syntax"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment