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
70898a06
Commit
70898a06
authored
May 23, 2013
by
Peter Baratta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pep8 fix
parent
db261dc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
common/lib/capa/capa/tests/test_responsetypes.py
+8
-7
No files found.
common/lib/capa/capa/tests/test_responsetypes.py
View file @
70898a06
...
@@ -223,7 +223,6 @@ class SymbolicResponseTest(ResponseTest):
...
@@ -223,7 +223,6 @@ class SymbolicResponseTest(ResponseTest):
for
(
input_str
,
input_mathml
)
in
incorrect_inputs
:
for
(
input_str
,
input_mathml
)
in
incorrect_inputs
:
self
.
_assert_symbolic_grade
(
problem
,
input_str
,
input_mathml
,
'incorrect'
)
self
.
_assert_symbolic_grade
(
problem
,
input_str
,
input_mathml
,
'incorrect'
)
def
test_complex_number_grade
(
self
):
def
test_complex_number_grade
(
self
):
problem
=
self
.
build_problem
(
math_display
=
True
,
problem
=
self
.
build_problem
(
math_display
=
True
,
expect
=
"[[cos(theta),i*sin(theta)],[i*sin(theta),cos(theta)]]"
,
expect
=
"[[cos(theta),i*sin(theta)],[i*sin(theta),cos(theta)]]"
,
...
@@ -241,7 +240,7 @@ class SymbolicResponseTest(ResponseTest):
...
@@ -241,7 +240,7 @@ class SymbolicResponseTest(ResponseTest):
# Correct answer
# Correct answer
with
mock
.
patch
.
object
(
requests
,
'post'
)
as
mock_post
:
with
mock
.
patch
.
object
(
requests
,
'post'
)
as
mock_post
:
# Simulate what the LaTeX-to-MathML server would
# Simulate what the LaTeX-to-MathML server would
# send for the correct response input
# send for the correct response input
mock_post
.
return_value
.
text
=
correct_snuggletex_response
mock_post
.
return_value
.
text
=
correct_snuggletex_response
...
@@ -323,7 +322,7 @@ class SymbolicResponseTest(ResponseTest):
...
@@ -323,7 +322,7 @@ class SymbolicResponseTest(ResponseTest):
dynamath_input
,
dynamath_input
,
expected_correctness
):
expected_correctness
):
input_dict
=
{
'1_2_1'
:
str
(
student_input
),
input_dict
=
{
'1_2_1'
:
str
(
student_input
),
'1_2_1_dynamath'
:
str
(
dynamath_input
)
}
'1_2_1_dynamath'
:
str
(
dynamath_input
)}
correct_map
=
problem
.
grade_answers
(
input_dict
)
correct_map
=
problem
.
grade_answers
(
input_dict
)
...
@@ -548,6 +547,7 @@ class FormulaResponseTest(ResponseTest):
...
@@ -548,6 +547,7 @@ class FormulaResponseTest(ResponseTest):
input_dict
=
{
'1_2_1'
:
'1/0'
}
input_dict
=
{
'1_2_1'
:
'1/0'
}
self
.
assertRaises
(
StudentInputError
,
problem
.
grade_answers
,
input_dict
)
self
.
assertRaises
(
StudentInputError
,
problem
.
grade_answers
,
input_dict
)
class
StringResponseTest
(
ResponseTest
):
class
StringResponseTest
(
ResponseTest
):
from
response_xml_factory
import
StringResponseXMLFactory
from
response_xml_factory
import
StringResponseXMLFactory
xml_factory_class
=
StringResponseXMLFactory
xml_factory_class
=
StringResponseXMLFactory
...
@@ -607,7 +607,7 @@ class StringResponseTest(ResponseTest):
...
@@ -607,7 +607,7 @@ class StringResponseTest(ResponseTest):
problem
=
self
.
build_problem
(
problem
=
self
.
build_problem
(
answer
=
"Michigan"
,
answer
=
"Michigan"
,
hintfn
=
"gimme_a_hint"
,
hintfn
=
"gimme_a_hint"
,
script
=
textwrap
.
dedent
(
"""
script
=
textwrap
.
dedent
(
"""
def gimme_a_hint(answer_ids, student_answers, new_cmap, old_cmap):
def gimme_a_hint(answer_ids, student_answers, new_cmap, old_cmap):
aid = answer_ids[0]
aid = answer_ids[0]
answer = student_answers[aid]
answer = student_answers[aid]
...
@@ -917,10 +917,11 @@ class NumericalResponseTest(ResponseTest):
...
@@ -917,10 +917,11 @@ class NumericalResponseTest(ResponseTest):
"""See if division by zero is handled correctly"""
"""See if division by zero is handled correctly"""
problem
=
self
.
build_problem
(
question_text
=
"What 5 * 10?"
,
problem
=
self
.
build_problem
(
question_text
=
"What 5 * 10?"
,
explanation
=
"The answer is 50"
,
explanation
=
"The answer is 50"
,
answer
=
"5e+1"
)
# Answer doesn't matter
answer
=
"5e+1"
)
# Answer doesn't matter
input_dict
=
{
'1_2_1'
:
'1/0'
}
input_dict
=
{
'1_2_1'
:
'1/0'
}
self
.
assertRaises
(
StudentInputError
,
problem
.
grade_answers
,
input_dict
)
self
.
assertRaises
(
StudentInputError
,
problem
.
grade_answers
,
input_dict
)
class
CustomResponseTest
(
ResponseTest
):
class
CustomResponseTest
(
ResponseTest
):
from
response_xml_factory
import
CustomResponseXMLFactory
from
response_xml_factory
import
CustomResponseXMLFactory
xml_factory_class
=
CustomResponseXMLFactory
xml_factory_class
=
CustomResponseXMLFactory
...
@@ -969,8 +970,8 @@ class CustomResponseTest(ResponseTest):
...
@@ -969,8 +970,8 @@ class CustomResponseTest(ResponseTest):
#
#
# 'answer_given' is the answer the student gave (if there is just one input)
# 'answer_given' is the answer the student gave (if there is just one input)
# or an ordered list of answers (if there are multiple inputs)
# or an ordered list of answers (if there are multiple inputs)
#
#
# The function should return a dict of the form
# The function should return a dict of the form
# { 'ok': BOOL, 'msg': STRING }
# { 'ok': BOOL, 'msg': STRING }
#
#
script
=
textwrap
.
dedent
(
"""
script
=
textwrap
.
dedent
(
"""
...
...
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