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
f0fb7784
Commit
f0fb7784
authored
Apr 16, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1856 from MITx/fix/will/pep8-fixes
Pep8 fixes for drag and drop tests
parents
9ac85b43
91794580
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
24 deletions
+29
-24
common/lib/capa/capa/verifiers/tests_draganddrop.py
+29
-24
No files found.
common/lib/capa/capa/verifiers/tests_draganddrop.py
View file @
f0fb7784
...
...
@@ -50,9 +50,7 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
correct_answer
=
[
{
'draggables'
:
[
'p'
],
'targets'
:
[
'p_l'
,
'p_r'
],
'targets'
:
[
'p_l'
,
'p_r'
],
'rule'
:
'anyof'
},
{
...
...
@@ -201,8 +199,7 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'left_side_tagret[molecule][p_target][p][1]'
,
'left_side_tagret[molecule][p_target][p][3]'
,
'right_side_tagret[molecule][p_target][p][1]'
,
'right_side_tagret[molecule][p_target][p][3]'
],
'right_side_tagret[molecule][p_target][p][3]'
],
'rule'
:
'unordered_equal'
}
]
...
...
@@ -290,7 +287,6 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
correct_answer
=
[]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_targets_false
(
self
):
user_input
=
'[{"1": "t1"},
\
{"name_with_icon": "t2"}]'
...
...
@@ -300,15 +296,13 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
def
test_multiple_images_per_target_true
(
self
):
user_input
=
'[{"1": "t1"}, {"name_with_icon": "t2"},
\
{"2": "t1"}]'
correct_answer
=
{
'1'
:
't1'
,
'name_with_icon'
:
't2'
,
'2'
:
't1'
}
correct_answer
=
{
'1'
:
't1'
,
'name_with_icon'
:
't2'
,
'2'
:
't1'
}
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_multiple_images_per_target_false
(
self
):
user_input
=
'[{"1": "t1"}, {"name_with_icon": "t2"},
\
{"2": "t1"}]'
correct_answer
=
{
'1'
:
't2'
,
'name_with_icon'
:
't2'
,
'2'
:
't1'
}
correct_answer
=
{
'1'
:
't2'
,
'name_with_icon'
:
't2'
,
'2'
:
't1'
}
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_targets_and_positions
(
self
):
...
...
@@ -460,7 +454,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'3'
],
'targets'
:
[
'target6'
],
'rule'
:
'anyof'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_reuse_draggable_with_mupliples
(
self
):
...
...
@@ -483,7 +478,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'3'
],
'targets'
:
[
'target6'
],
'rule'
:
'anyof'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_reuse_many_draggable_with_mupliples
(
self
):
...
...
@@ -512,7 +508,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'3'
],
'targets'
:
[
'target6'
],
'rule'
:
'anyof'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_reuse_many_draggable_with_mupliples_wrong
(
self
):
...
...
@@ -567,7 +564,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unordered_equal'
}]
}
]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_
(
self
):
...
...
@@ -591,7 +589,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unordered_equal'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_multiple
(
self
):
...
...
@@ -615,7 +614,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'anyof+number'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_multiple_false
(
self
):
...
...
@@ -639,7 +639,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'anyof+number'
}]
}
]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_reused
(
self
):
...
...
@@ -663,7 +664,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unordered_equal+number'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_reused_false
(
self
):
...
...
@@ -687,7 +689,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unordered_equal+number'
}]
}
]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_mixed_reuse_and_not_reuse
(
self
):
...
...
@@ -705,7 +708,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
],
'rule'
:
'exact'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_mixed_reuse_and_not_reuse_number
(
self
):
...
...
@@ -722,7 +726,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
],
'rule'
:
'exact'
}]
}
]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_mixed_reuse_and_not_reuse_number_false
(
self
):
...
...
@@ -739,7 +744,8 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
],
'rule'
:
'exact'
}]
}
]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_alternative_correct_answer
(
self
):
...
...
@@ -828,8 +834,7 @@ def suite():
testcases
=
[
Test_PositionsCompare
,
Test_DragAndDrop_Populate
,
Test_DragAndDrop_Grade
,
Test_DraAndDrop_Compare_Positions
]
Test_DraAndDrop_Compare_Positions
]
suites
=
[]
for
testcase
in
testcases
:
suites
.
append
(
unittest
.
TestLoader
()
.
loadTestsFromTestCase
(
testcase
))
...
...
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