started tests and add graders to capa_problem
This commit is contained in:
@@ -34,6 +34,8 @@ import chem
|
||||
import chem.chemcalc
|
||||
import chem.chemtools
|
||||
import chem.miller
|
||||
import graders
|
||||
import graders.draganddrop
|
||||
|
||||
import calc
|
||||
from correctmap import CorrectMap
|
||||
@@ -69,7 +71,8 @@ global_context = {'random': random,
|
||||
'eia': eia,
|
||||
'chemcalc': chem.chemcalc,
|
||||
'chemtools': chem.chemtools,
|
||||
'miller': chem.miller}
|
||||
'miller': chem.miller,
|
||||
'draganddrop': graders.draganddrop}
|
||||
|
||||
# These should be removed from HTML output, including all subelements
|
||||
html_problem_semantics = ["codeparam", "responseparam", "answer", "script", "hintgroup", "openendedparam","openendedrubric"]
|
||||
|
||||
@@ -5,9 +5,16 @@ import draganddrop
|
||||
|
||||
class Test_DragAndDrop(unittest.TestCase):
|
||||
|
||||
def test_1(self):
|
||||
user_input = '{"laice": "bcc", "points": [["0.00", "1.00", "0.00"], ["1.00", "1.00", "0.00"], ["0.00", "0.00", "1.00"]]}'
|
||||
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))
|
||||
|
||||
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))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user