Commit 70898a06 by Peter Baratta

Pep8 fix

parent db261dc1
...@@ -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("""
......
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