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
5391cefd
Commit
5391cefd
authored
Mar 29, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in tests to see if max score properly exposed and calculated in combinedopenended
parent
53620d78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+41
-4
No files found.
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
5391cefd
...
@@ -5,11 +5,15 @@ import unittest
...
@@ -5,11 +5,15 @@ import unittest
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
from
xmodule.open_ended_grading_classes.combined_open_ended_modulev1
import
CombinedOpenEndedV1Module
from
xmodule.open_ended_grading_classes.combined_open_ended_modulev1
import
CombinedOpenEndedV1Module
from
xmodule.combined_open_ended_module
import
CombinedOpenEndedModule
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
lxml
import
etree
from
lxml
import
etree
import
capa.xqueue_interface
as
xqueue_interface
import
capa.xqueue_interface
as
xqueue_interface
from
datetime
import
datetime
from
datetime
import
datetime
import
logging
log
=
logging
.
getLogger
(
__name__
)
from
.
import
test_system
from
.
import
test_system
...
@@ -57,7 +61,7 @@ class OpenEndedChildTest(unittest.TestCase):
...
@@ -57,7 +61,7 @@ class OpenEndedChildTest(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
test_system
=
test_system
()
self
.
test_system
=
test_system
()
self
.
openendedchild
=
OpenEndedChild
(
self
.
test_system
,
self
.
location
,
self
.
openendedchild
=
OpenEndedChild
(
self
.
test_system
,
self
.
location
,
self
.
definition
,
self
.
descriptor
,
self
.
static_data
,
self
.
metadata
)
self
.
definition
,
self
.
descriptor
,
self
.
static_data
,
self
.
metadata
)
def
test_latest_answer_empty
(
self
):
def
test_latest_answer_empty
(
self
):
...
@@ -183,10 +187,12 @@ class OpenEndedModuleTest(unittest.TestCase):
...
@@ -183,10 +187,12 @@ class OpenEndedModuleTest(unittest.TestCase):
self
.
test_system
.
location
=
self
.
location
self
.
test_system
.
location
=
self
.
location
self
.
mock_xqueue
=
MagicMock
()
self
.
mock_xqueue
=
MagicMock
()
self
.
mock_xqueue
.
send_to_queue
.
return_value
=
(
None
,
"Message"
)
self
.
mock_xqueue
.
send_to_queue
.
return_value
=
(
None
,
"Message"
)
def
constructed_callback
(
dispatch
=
"score_update"
):
def
constructed_callback
(
dispatch
=
"score_update"
):
return
dispatch
return
dispatch
self
.
test_system
.
xqueue
=
{
'interface'
:
self
.
mock_xqueue
,
'construct_callback'
:
constructed_callback
,
'default_queuename'
:
'testqueue'
,
self
.
test_system
.
xqueue
=
{
'interface'
:
self
.
mock_xqueue
,
'construct_callback'
:
constructed_callback
,
'default_queuename'
:
'testqueue'
,
'waittime'
:
1
}
'waittime'
:
1
}
self
.
openendedmodule
=
OpenEndedModule
(
self
.
test_system
,
self
.
location
,
self
.
openendedmodule
=
OpenEndedModule
(
self
.
test_system
,
self
.
location
,
self
.
definition
,
self
.
descriptor
,
self
.
static_data
,
self
.
metadata
)
self
.
definition
,
self
.
descriptor
,
self
.
static_data
,
self
.
metadata
)
...
@@ -281,7 +287,18 @@ class OpenEndedModuleTest(unittest.TestCase):
...
@@ -281,7 +287,18 @@ class OpenEndedModuleTest(unittest.TestCase):
class
CombinedOpenEndedModuleTest
(
unittest
.
TestCase
):
class
CombinedOpenEndedModuleTest
(
unittest
.
TestCase
):
location
=
Location
([
"i4x"
,
"edX"
,
"open_ended"
,
"combinedopenended"
,
location
=
Location
([
"i4x"
,
"edX"
,
"open_ended"
,
"combinedopenended"
,
"SampleQuestion"
])
"SampleQuestion"
])
definition_template
=
"""
<combinedopenended attempts="10000">
{rubric}
{prompt}
<task>
{task1}
</task>
<task>
{task2}
</task>
</combinedopenended>
"""
prompt
=
"<prompt>This is a question prompt</prompt>"
prompt
=
"<prompt>This is a question prompt</prompt>"
rubric
=
'''<rubric><rubric>
rubric
=
'''<rubric><rubric>
<category>
<category>
...
@@ -335,6 +352,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
...
@@ -335,6 +352,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
</openendedparam>
</openendedparam>
</openended>'''
</openended>'''
definition
=
{
'prompt'
:
etree
.
XML
(
prompt
),
'rubric'
:
etree
.
XML
(
rubric
),
'task_xml'
:
[
task_xml1
,
task_xml2
]}
definition
=
{
'prompt'
:
etree
.
XML
(
prompt
),
'rubric'
:
etree
.
XML
(
rubric
),
'task_xml'
:
[
task_xml1
,
task_xml2
]}
full_definition
=
definition_template
.
format
(
prompt
=
prompt
,
rubric
=
rubric
,
task1
=
task_xml1
,
task2
=
task_xml2
)
descriptor
=
Mock
()
descriptor
=
Mock
()
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -368,3 +386,21 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
...
@@ -368,3 +386,21 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
changed
=
self
.
combinedoe
.
update_task_states
()
changed
=
self
.
combinedoe
.
update_task_states
()
self
.
assertTrue
(
changed
)
self
.
assertTrue
(
changed
)
def
test_get_max_score
(
self
):
changed
=
self
.
combinedoe
.
update_task_states
()
self
.
combinedoe
.
state
=
"done"
self
.
combinedoe
.
is_scored
=
True
max_score
=
self
.
combinedoe
.
max_score
()
self
.
assertEqual
(
max_score
,
1
)
def
test_container_get_max_score
(
self
):
definition
=
self
.
full_definition
descriptor
=
Mock
(
data
=
definition
)
combinedoe_container
=
CombinedOpenEndedModule
(
self
.
test_system
,
self
.
location
,
descriptor
,
model_data
=
{
'data'
:
definition
})
#The progress view requires that this function be exposed
max_score
=
combinedoe_container
.
max_score
()
self
.
assertEqual
(
max_score
,
None
)
\ 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