unorderly->unordered
This commit is contained in:
@@ -144,7 +144,7 @@ class DragAndDrop(object):
|
|||||||
# every element are equal with correct positions
|
# every element are equal with correct positions
|
||||||
for groupname in self.correct_groups:
|
for groupname in self.correct_groups:
|
||||||
rules_executed = 0
|
rules_executed = 0
|
||||||
for rule in ('exact', 'anyof', 'unorderly_equal'):
|
for rule in ('exact', 'anyof', 'unordered_equal'):
|
||||||
# every group has only one rule
|
# every group has only one rule
|
||||||
if self.correct_positions[groupname].get(rule, None):
|
if self.correct_positions[groupname].get(rule, None):
|
||||||
rules_executed += 1
|
rules_executed += 1
|
||||||
@@ -190,7 +190,7 @@ class DragAndDrop(object):
|
|||||||
- draggables can be placed in any order:
|
- draggables can be placed in any order:
|
||||||
user ['1','2','3','4'] is 'anyof' equal to ['4', '2', '1', 3']
|
user ['1','2','3','4'] is 'anyof' equal to ['4', '2', '1', 3']
|
||||||
|
|
||||||
'unorderly_equal' is same as 'exact' but disregards on order
|
'unordered_equal' is same as 'exact' but disregards on order
|
||||||
|
|
||||||
Equality functions:
|
Equality functions:
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ class DragAndDrop(object):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if flag == 'unorderly_equal':
|
if flag == 'unordered_equal':
|
||||||
if len(correct) != len(user):
|
if len(correct) != len(user):
|
||||||
return False
|
return False
|
||||||
temp = correct[:]
|
temp = correct[:]
|
||||||
|
|||||||
@@ -343,17 +343,17 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
|
|||||||
{
|
{
|
||||||
'draggables': ['a'],
|
'draggables': ['a'],
|
||||||
'targets': ['target1', 'target4', 'target7', 'target10'],
|
'targets': ['target1', 'target4', 'target7', 'target10'],
|
||||||
'rule': 'unorderly_equal'
|
'rule': 'unordered_equal'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'draggables': ['b'],
|
'draggables': ['b'],
|
||||||
'targets': ['target2', 'target5', 'target8'],
|
'targets': ['target2', 'target5', 'target8'],
|
||||||
'rule': 'unorderly_equal'
|
'rule': 'unordered_equal'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'draggables': ['c'],
|
'draggables': ['c'],
|
||||||
'targets': ['target3', 'target6', 'target9'],
|
'targets': ['target3', 'target6', 'target9'],
|
||||||
'rule': 'unorderly_equal'
|
'rule': 'unordered_equal'
|
||||||
}]
|
}]
|
||||||
self.assertTrue(draganddrop.grade(user_input, correct_answer))
|
self.assertTrue(draganddrop.grade(user_input, correct_answer))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user