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
4215f4f9
Commit
4215f4f9
authored
Jan 16, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add and update tests
parent
de35d1e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
11 deletions
+64
-11
common/lib/capa/capa/verifiers/tests_draganddrop.py
+64
-11
No files found.
common/lib/capa/capa/verifiers/tests_draganddrop.py
View file @
4215f4f9
...
@@ -319,17 +319,17 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
...
@@ -319,17 +319,17 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
{
{
'draggables'
:
[
'a'
],
'draggables'
:
[
'a'
],
'targets'
:
[
'target1'
,
'target4'
,
'target7'
,
'target10'
],
'targets'
:
[
'target1'
,
'target4'
,
'target7'
,
'target10'
],
'rule'
:
'unorder
ly
_equal'
'rule'
:
'unorder
ed
_equal'
},
},
{
{
'draggables'
:
[
'b'
],
'draggables'
:
[
'b'
],
'targets'
:
[
'target2'
,
'target5'
,
'target8'
],
'targets'
:
[
'target2'
,
'target5'
,
'target8'
],
'rule'
:
'unorder
ly
_equal'
'rule'
:
'unorder
ed
_equal'
},
},
{
{
'draggables'
:
[
'c'
],
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unorder
ly
_equal'
'rule'
:
'unorder
ed
_equal'
}]
}]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
...
@@ -406,7 +406,7 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
...
@@ -406,7 +406,7 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_reused
(
self
):
def
test_label_10_targets_with_a_b_c_reused
(
self
):
"""Test
reusable draggables (no mupltiple draggables per target)
"""
"""Test
a b c in 10 labels reused
"""
user_input
=
'{"draggables":[{"a":"target1"},
\
user_input
=
'{"draggables":[{"a":"target1"},
\
{"b":"target2"},{"c":"target3"},{"b":"target5"},
\
{"b":"target2"},{"c":"target3"},{"b":"target5"},
\
{"c":"target6"}, {"b":"target8"},{"c":"target9"},
\
{"c":"target6"}, {"b":"target8"},{"c":"target9"},
\
...
@@ -415,22 +415,22 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
...
@@ -415,22 +415,22 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
{
{
'draggables'
:
[
'a'
,
'a'
],
'draggables'
:
[
'a'
,
'a'
],
'targets'
:
[
'target1'
,
'target10'
],
'targets'
:
[
'target1'
,
'target10'
],
'rule'
:
'unorder
ly
_equal+number'
'rule'
:
'unorder
ed
_equal+number'
},
},
{
{
'draggables'
:
[
'b'
,
'b'
,
'b'
],
'draggables'
:
[
'b'
,
'b'
,
'b'
],
'targets'
:
[
'target2'
,
'target5'
,
'target8'
],
'targets'
:
[
'target2'
,
'target5'
,
'target8'
],
'rule'
:
'unorder
ly
_equal+number'
'rule'
:
'unorder
ed
_equal+number'
},
},
{
{
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unorder
ly
_equal+number'
'rule'
:
'unorder
ed
_equal+number'
}]
}]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_label_10_targets_with_a_b_c_reused_false
(
self
):
def
test_label_10_targets_with_a_b_c_reused_false
(
self
):
"""Test
reusable draggables (no mupltiple draggables per target)
"""
"""Test
a b c in 10 labels reused false
"""
user_input
=
'{"draggables":[{"a":"target1"},
\
user_input
=
'{"draggables":[{"a":"target1"},
\
{"b":"target2"},{"c":"target3"},{"b":"target5"}, {"a":"target8"},
\
{"b":"target2"},{"c":"target3"},{"b":"target5"}, {"a":"target8"},
\
{"c":"target6"}, {"b":"target8"},{"c":"target9"},
\
{"c":"target6"}, {"b":"target8"},{"c":"target9"},
\
...
@@ -439,20 +439,73 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
...
@@ -439,20 +439,73 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
{
{
'draggables'
:
[
'a'
,
'a'
],
'draggables'
:
[
'a'
,
'a'
],
'targets'
:
[
'target1'
,
'target10'
],
'targets'
:
[
'target1'
,
'target10'
],
'rule'
:
'unorder
ly
_equal+number'
'rule'
:
'unorder
ed
_equal+number'
},
},
{
{
'draggables'
:
[
'b'
,
'b'
,
'b'
],
'draggables'
:
[
'b'
,
'b'
,
'b'
],
'targets'
:
[
'target2'
,
'target5'
,
'target8'
],
'targets'
:
[
'target2'
,
'target5'
,
'target8'
],
'rule'
:
'unorder
ly
_equal+number'
'rule'
:
'unorder
ed
_equal+number'
},
},
{
{
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'draggables'
:
[
'c'
,
'c'
,
'c'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'targets'
:
[
'target3'
,
'target6'
,
'target9'
],
'rule'
:
'unorder
ly
_equal+number'
'rule'
:
'unorder
ed
_equal+number'
}]
}]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_mixed_reuse_and_not_reuse
(
self
):
"""Test reusable draggables """
user_input
=
'{"draggables":[{"a":"target1"},
\
{"b":"target2"},{"c":"target3"}, {"a":"target4"},
\
{"a":"target5"}]}'
correct_answer
=
[
{
'draggables'
:
[
'a'
,
'b'
],
'targets'
:
[
'target1'
,
'target2'
,
'target4'
,
'target5'
],
'rule'
:
'anyof'
},
{
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
],
'rule'
:
'exact'
}]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_mixed_reuse_and_not_reuse_number
(
self
):
"""Test reusable draggables with number """
user_input
=
'{"draggables":[{"a":"target1"},
\
{"b":"target2"},{"c":"target3"}, {"a":"target4"}]}'
correct_answer
=
[
{
'draggables'
:
[
'a'
,
'a'
,
'b'
],
'targets'
:
[
'target1'
,
'target2'
,
'target4'
],
'rule'
:
'anyof+number'
},
{
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
],
'rule'
:
'exact'
}]
self
.
assertTrue
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
def
test_mixed_reuse_and_not_reuse_number_false
(
self
):
"""Test reusable draggables with numbers, but wrong"""
user_input
=
'{"draggables":[{"a":"target1"},
\
{"b":"target2"},{"c":"target3"}, {"a":"target4"}, {"a":"target10"}]}'
correct_answer
=
[
{
'draggables'
:
[
'a'
,
'a'
,
'b'
],
'targets'
:
[
'target1'
,
'target2'
,
'target4'
,
'target10'
],
'rule'
:
'anyof_number'
},
{
'draggables'
:
[
'c'
],
'targets'
:
[
'target3'
],
'rule'
:
'exact'
}]
self
.
assertFalse
(
draganddrop
.
grade
(
user_input
,
correct_answer
))
class
Test_DragAndDrop_Populate
(
unittest
.
TestCase
):
class
Test_DragAndDrop_Populate
(
unittest
.
TestCase
):
def
test_1
(
self
):
def
test_1
(
self
):
...
...
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