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
8f89768d
Commit
8f89768d
authored
Feb 27, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added annotationresponse grade test
parent
2f4d6f7b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
common/lib/capa/capa/responsetypes.py
+1
-2
common/lib/capa/capa/tests/test_files/annotationresponse.xml
+17
-0
common/lib/capa/capa/tests/test_responsetypes.py
+14
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
8f89768d
...
...
@@ -1848,8 +1848,7 @@ class AnnotationResponse(LoncapaResponse):
Checking of annotation responses.
The response contains both a comment (student commentary) and an option (student tag).
Only the tag is currently graded. Answers may be incorrect, partially correct, or correct
and are scored accordingly.
Only the tag is currently graded. Answers may be incorrect, partially correct, or correct.
'''
response_tag
=
'annotationresponse'
allowed_inputfields
=
[
'annotationinput'
]
...
...
common/lib/capa/capa/tests/test_files/annotationresponse.xml
0 → 100644
View file @
8f89768d
<problem
display_name=
"Exercise 1"
>
<annotationresponse>
<annotationinput>
<title>
the title
</title>
<text>
the text
</text>
<comment>
the comment
</comment>
<comment_prompt>
Type a commentary below:
</comment_prompt>
<tag_prompt>
Select one or more tags:
</tag_prompt>
<options>
<option
choice=
"correct"
>
green
</option>
<option
choice=
"incorrect"
>
eggs
</option>
<option
choice=
"partially-correct"
>
ham
</option>
</options>
</annotationinput>
</annotationresponse>
<solution>
Instructor text here...
</solution>
</problem>
common/lib/capa/capa/tests/test_responsetypes.py
View file @
8f89768d
...
...
@@ -428,4 +428,16 @@ class JavascriptResponseTest(unittest.TestCase):
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
class
AnnotationResponseTest
(
unittest
.
TestCase
):
pass
\ No newline at end of file
def
test_grade
(
self
):
annotationresponse_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/annotationresponse.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
annotationresponse_file
)
.
read
(),
'1'
,
system
=
test_system
)
answers_for
=
{
'correct'
:
{
'1_2_1'
:
json
.
dumps
({
'options'
:[
0
]})},
'incorrect'
:
{
'1_2_1'
:
json
.
dumps
({
'options'
:[
1
]})},
'partially-correct'
:
{
'1_2_1'
:
json
.
dumps
({
'options'
:[
2
]})}
}
for
expected_correctness
in
answers_for
.
keys
():
actual_correctness
=
test_lcp
.
grade_answers
(
answers_for
[
expected_correctness
])
.
get_correctness
(
'1_2_1'
)
self
.
assertEquals
(
expected_correctness
,
actual_correctness
)
\ No newline at end of file
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