Commit ff0f2161 by Alexander Kryklia

started tests and add graders to capa_problem

parent f9169613
...@@ -34,6 +34,8 @@ import chem ...@@ -34,6 +34,8 @@ import chem
import chem.chemcalc import chem.chemcalc
import chem.chemtools import chem.chemtools
import chem.miller import chem.miller
import graders
import graders.draganddrop
import calc import calc
from correctmap import CorrectMap from correctmap import CorrectMap
...@@ -69,7 +71,8 @@ global_context = {'random': random, ...@@ -69,7 +71,8 @@ global_context = {'random': random,
'eia': eia, 'eia': eia,
'chemcalc': chem.chemcalc, 'chemcalc': chem.chemcalc,
'chemtools': chem.chemtools, 'chemtools': chem.chemtools,
'miller': chem.miller} 'miller': chem.miller,
'draganddrop': graders.draganddrop}
# These should be removed from HTML output, including all subelements # These should be removed from HTML output, including all subelements
html_problem_semantics = ["codeparam", "responseparam", "answer", "script", "hintgroup", "openendedparam","openendedrubric"] html_problem_semantics = ["codeparam", "responseparam", "answer", "script", "hintgroup", "openendedparam","openendedrubric"]
......
...@@ -5,9 +5,16 @@ import draganddrop ...@@ -5,9 +5,16 @@ import draganddrop
class Test_DragAndDrop(unittest.TestCase): class Test_DragAndDrop(unittest.TestCase):
def test_1(self): def test_targets_true(self):
user_input = '{"laice": "bcc", "points": [["0.00", "1.00", "0.00"], ["1.00", "1.00", "0.00"], ["0.00", "0.00", "1.00"]]}' user_input = '{"use_targets": "true", "draggables": \
correct_answer = {} ["1": "t1", "name_with_icon": "t2"]}'
correct_answer = {'1': 't1', 'name_with_icon': 't2'}
self.assertTrue(draganddrop.grade(user_input, correct_answer))
def test_targets_true(self):
user_input = '{"use_targets": "true", "draggables": \
["1": "t1", "name_with_icon": "t2"]}'
correct_answer = {'1': 't1', 'name_with_icon': 't2'}
self.assertTrue(draganddrop.grade(user_input, correct_answer)) self.assertTrue(draganddrop.grade(user_input, correct_answer))
......
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