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
cb2fbfa5
Commit
cb2fbfa5
authored
Aug 07, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for answers file-to-filename conversion
parent
ceeea664
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
common/lib/xmodule/xmodule/tests/__init__.py
+13
-2
No files found.
common/lib/xmodule/xmodule/tests/__init__.py
View file @
cb2fbfa5
...
...
@@ -15,6 +15,7 @@ import xmodule
import
capa.calc
as
calc
import
capa.capa_problem
as
lcp
from
capa.correctmap
import
CorrectMap
from
capa.util
import
convert_files_to_filenames
from
xmodule
import
graders
,
x_module
from
xmodule.x_module
import
ModuleSystem
from
xmodule.graders
import
Score
,
aggregate_scores
...
...
@@ -278,7 +279,6 @@ class StringResponseWithHintTest(unittest.TestCase):
class
CodeResponseTest
(
unittest
.
TestCase
):
'''
Test CodeResponse
'''
def
test_update_score
(
self
):
problem_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/coderesponse.xml"
...
...
@@ -327,7 +327,18 @@ class CodeResponseTest(unittest.TestCase):
self
.
assertFalse
(
test_lcp
.
correct_map
.
is_queued
(
answer_ids
[
j
]))
# Should be dequeued, message delivered
else
:
self
.
assertTrue
(
test_lcp
.
correct_map
.
is_queued
(
answer_ids
[
j
]))
# Should be queued, message undelivered
def
test_convert_files_to_filenames
(
self
):
problem_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/coderesponse.xml"
fp
=
open
(
problem_file
)
answers_with_file
=
{
'1_2_1'
:
'String-based answer'
,
'1_3_1'
:
[
'answer1'
,
'answer2'
,
'answer3'
],
'1_4_1'
:
fp
}
answers_converted
=
convert_files_to_filenames
(
answers_with_file
)
self
.
assertEquals
(
answers_converted
[
'1_2_1'
],
'String-based answer'
)
self
.
assertEquals
(
answers_converted
[
'1_3_1'
],
[
'answer1'
,
'answer2'
,
'answer3'
])
self
.
assertEquals
(
answers_converted
[
'1_4_1'
],
fp
.
name
)
class
ChoiceResponseTest
(
unittest
.
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