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
cc8ecb18
Commit
cc8ecb18
authored
Jul 02, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make xmodule tests pass again
parent
8f595216
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
15 deletions
+12
-15
common/lib/xmodule/tests/__init__.py
+12
-15
common/lib/xmodule/tests/test_files/formularesponse_with_hint.xml
+0
-0
common/lib/xmodule/tests/test_files/imageresponse.xml
+0
-0
common/lib/xmodule/tests/test_files/multi_bare.xml
+0
-0
common/lib/xmodule/tests/test_files/multichoice.xml
+0
-0
common/lib/xmodule/tests/test_files/optionresponse.xml
+0
-0
common/lib/xmodule/tests/test_files/stringresponse_with_hint.xml
+0
-0
common/lib/xmodule/tests/test_files/symbolicresponse.xml
+0
-0
common/lib/xmodule/tests/test_files/truefalse.xml
+0
-0
No files found.
common/lib/xmodule/tests/__init__.py
View file @
cc8ecb18
...
...
@@ -43,12 +43,10 @@ class ModelsTest(unittest.TestCase):
def
setUp
(
self
):
pass
def
test_
get_module
_class
(
self
):
vc
=
xmodule
.
get_module
_class
(
'video'
)
vc_str
=
"<class 'xmodule.video_module.
Module
'>"
def
test_
load
_class
(
self
):
vc
=
xmodule
.
x_module
.
XModuleDescriptor
.
load
_class
(
'video'
)
vc_str
=
"<class 'xmodule.video_module.
VideoDescriptor
'>"
self
.
assertEqual
(
str
(
vc
),
vc_str
)
video_id
=
xmodule
.
get_default_ids
()[
'video'
]
self
.
assertEqual
(
video_id
,
'youtube'
)
def
test_calc
(
self
):
variables
=
{
'R1'
:
2.0
,
'R3'
:
4.0
}
...
...
@@ -98,7 +96,7 @@ class ModelsTest(unittest.TestCase):
class
MultiChoiceTest
(
unittest
.
TestCase
):
def
test_MC_grade
(
self
):
multichoice_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/multichoice.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
multichoice_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
multichoice_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'choice_foil3'
}
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
false_answers
=
{
'1_2_1'
:
'choice_foil2'
}
...
...
@@ -106,7 +104,7 @@ class MultiChoiceTest(unittest.TestCase):
def
test_MC_bare_grades
(
self
):
multichoice_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/multi_bare.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
multichoice_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
multichoice_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'choice_2'
}
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
false_answers
=
{
'1_2_1'
:
'choice_1'
}
...
...
@@ -114,7 +112,7 @@ class MultiChoiceTest(unittest.TestCase):
def
test_TF_grade
(
self
):
truefalse_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/truefalse.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
truefalse_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
truefalse_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:[
'choice_foil2'
,
'choice_foil1'
]}
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
false_answers
=
{
'1_2_1'
:[
'choice_foil1'
]}
...
...
@@ -129,7 +127,7 @@ class MultiChoiceTest(unittest.TestCase):
class
ImageResponseTest
(
unittest
.
TestCase
):
def
test_ir_grade
(
self
):
imageresponse_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/imageresponse.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
imageresponse_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
imageresponse_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'(490,11)-(556,98)'
,
'1_2_2'
:
'(242,202)-(296,276)'
}
test_answers
=
{
'1_2_1'
:
'[500,20]'
,
...
...
@@ -142,7 +140,7 @@ class SymbolicResponseTest(unittest.TestCase):
def
test_sr_grade
(
self
):
raise
SkipTest
()
# This test fails due to dependencies on a local copy of snuggletex-webapp. Until we have figured that out, we'll just skip this test
symbolicresponse_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/symbolicresponse.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
symbolicresponse_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
symbolicresponse_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]'
,
'1_2_1_dynamath'
:
'''
<math xmlns="http://www.w3.org/1998/Math/MathML">
...
...
@@ -235,7 +233,7 @@ class OptionResponseTest(unittest.TestCase):
'''
def
test_or_grade
(
self
):
optionresponse_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/optionresponse.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
optionresponse_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
optionresponse_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'True'
,
'1_2_2'
:
'False'
}
test_answers
=
{
'1_2_1'
:
'True'
,
...
...
@@ -251,7 +249,7 @@ class FormulaResponseWithHintTest(unittest.TestCase):
'''
def
test_or_grade
(
self
):
problem_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/formularesponse_with_hint.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
problem_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
problem_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'2.5*x-5.0'
}
test_answers
=
{
'1_2_1'
:
'0.4*x-5.0'
}
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
...
...
@@ -265,7 +263,7 @@ class StringResponseWithHintTest(unittest.TestCase):
'''
def
test_or_grade
(
self
):
problem_file
=
os
.
path
.
dirname
(
__file__
)
+
"/test_files/stringresponse_with_hint.xml"
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
problem_file
),
'1'
,
system
=
i4xs
)
test_lcp
=
lcp
.
LoncapaProblem
(
open
(
problem_file
)
.
read
()
,
'1'
,
system
=
i4xs
)
correct_answers
=
{
'1_2_1'
:
'Michigan'
}
test_answers
=
{
'1_2_1'
:
'Minnesota'
}
self
.
assertEquals
(
test_lcp
.
grade_answers
(
correct_answers
)
.
get_correctness
(
'1_2_1'
),
'correct'
)
...
...
@@ -618,7 +616,6 @@ class ModuleProgressTest(unittest.TestCase):
'''
def
test_xmodule_default
(
self
):
'''Make sure default get_progress exists, returns None'''
xm
=
x_module
.
XModule
(
i4xs
,
"<dummy />"
,
"dummy"
)
xm
=
x_module
.
XModule
(
i4xs
,
'a://b/c/d/e'
,
{}
)
p
=
xm
.
get_progress
()
self
.
assertEqual
(
p
,
None
)
common/lib/xmodule/test_files/formularesponse_with_hint.xml
→
common/lib/xmodule/test
s/test
_files/formularesponse_with_hint.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/imageresponse.xml
→
common/lib/xmodule/test
s/test
_files/imageresponse.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/multi_bare.xml
→
common/lib/xmodule/test
s/test
_files/multi_bare.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/multichoice.xml
→
common/lib/xmodule/test
s/test
_files/multichoice.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/optionresponse.xml
→
common/lib/xmodule/test
s/test
_files/optionresponse.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/stringresponse_with_hint.xml
→
common/lib/xmodule/test
s/test
_files/stringresponse_with_hint.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/symbolicresponse.xml
→
common/lib/xmodule/test
s/test
_files/symbolicresponse.xml
View file @
cc8ecb18
File moved
common/lib/xmodule/test_files/truefalse.xml
→
common/lib/xmodule/test
s/test
_files/truefalse.xml
View file @
cc8ecb18
File moved
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