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
5ba2c2e7
Commit
5ba2c2e7
authored
Nov 01, 2012
by
Александр
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted unittests
parent
5755325a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
39 deletions
+29
-39
common/lib/capa/capa/chem/chemtools.py
+29
-39
No files found.
common/lib/capa/capa/chem/chemtools.py
View file @
5ba2c2e7
...
@@ -77,60 +77,50 @@ class Test_Grade(unittest.TestCase):
...
@@ -77,60 +77,50 @@ class Test_Grade(unittest.TestCase):
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX3E0","atoms":{"c0":"B","p0":"F","p1":"B","p2":"F"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX3E0","atoms":{"c0":"B","p0":"F","p1":"B","p2":"F"}}'
)
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
))
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_incorrect_positions
(
self
):
def
test_correct_answer_p
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX4E0"
,
atoms
=
{
"c0"
:
"N"
,
"p0"
:
"H"
,
"p1"
:
"(ep)"
,
"p2"
:
"H"
,
"p3"
:
"H"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX4E0","atoms":{"c0":"B","p0":"F","p1":"B","p2":"F"}}'
)
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_correct_answer
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX4E0"
,
atoms
=
{
"c0"
:
"N"
,
"p0"
:
"H"
,
"p1"
:
"(ep)"
,
"p2"
:
"H"
,
"p3"
:
"H"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX4E0"
,
atoms
=
{
"c0"
:
"N"
,
"p0"
:
"H"
,
"p1"
:
"(ep)"
,
"p2"
:
"H"
,
"p3"
:
"H"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX4E0","atoms":{"c0":"N","p0":"H","p1":"(ep)","p2":"H", "p3":"H"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX4E0","atoms":{"c0":"N","p0":"H","p1":"(ep)","p2":"H", "p3":"H"}}'
)
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
))
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_incorrect_position_order_p
(
self
):
def
test_correct_answer_ae
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX4E0"
,
atoms
=
{
"c0"
:
"N"
,
"p0"
:
"H"
,
"p1"
:
"(ep)"
,
"p2"
:
"H"
,
"p3"
:
"H"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX4E0","atoms":{"c0":"N","p0":"H","p1":"H","p2":"(ep)", "p3":"H"}}'
)
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_correct_position_order_with_ignore_p_order
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX4E0"
,
atoms
=
{
"c0"
:
"N"
,
"p0"
:
"H"
,
"p1"
:
"(ep)"
,
"p2"
:
"H"
,
"p3"
:
"H"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX4E0","atoms":{"c0":"N","p0":"H","p1":"H","p2":"(ep)", "p3":"H"}}'
)
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_p_order
=
True
))
def
test_incorrect_position_order_ae
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"test"
,
"a1"
:
"(ep)"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"(ep)"
,
"e3"
:
"(ep)"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"test"
,
"a1"
:
"(ep)"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"(ep)"
,
"e3"
:
"(ep)"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e
0":"H","e1":"(ep)","e2":"(ep)","e3
":"(ep)"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e
10":"H","e11":"H","e20":"(ep)","e21
":"(ep)"}}'
)
self
.
assert
Fals
e
(
vsepr_grade
(
user_answer
,
correct_answer
))
self
.
assert
Tru
e
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_correct_
position_order_with_ignore_a_order_not_e
(
self
):
def
test_correct_
answer_ae_convert_to_p_but_input_not_in_p
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"(ep)"
,
"e3"
:
"(ep)"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"(ep)"
,
"e3"
:
"(ep)"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e
0":"H","e1":"H","e2":"(ep)","e3
":"(ep)"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e
10":"H","e11":"(ep)","e20":"H","e21
":"(ep)"}}'
)
self
.
assert
True
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_a_order
=
True
))
self
.
assert
False
(
vsepr_grade
(
user_answer
,
correct_answer
,
convert_to_perepherial
=
True
))
def
test_
incorrect_position_order_with_ignore_a_order_not_e
(
self
):
def
test_
correct_answer_ae_convert_to_p
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"
a0"
:
"(ep)"
,
"a1"
:
"test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"H"
,
"e3
"
:
"(ep)"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"
p0"
:
"(ep)"
,
"p1"
:
"test"
,
"p2"
:
"H"
,
"p3"
:
"H"
,
"p4"
:
"(ep)"
,
"p6
"
:
"(ep)"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e
0":"H","e1":"H","e2":"(ep)","e3":"H
"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e
10":"H","e11":"(ep)","e20":"H","e21":"(ep)
"}}'
)
self
.
assert
False
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_a_order
=
True
))
self
.
assert
True
(
vsepr_grade
(
user_answer
,
correct_answer
,
convert_to_perepherial
=
True
))
def
test_correct_
position_order_with_ignore_e_order_not
_a
(
self
):
def
test_correct_
answer_e1e2_in
_a
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"
test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"H"
,
"e3"
:
"(ep)
"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"
(ep)"
,
"e10"
:
"H"
,
"e11"
:
"H"
,
"e20"
:
"H"
,
"e21"
:
"H
"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"(ep)","a1":"
test","e0":"H","e1":"H","e2":"(ep)","e3
":"H"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"(ep)","a1":"
(ep)","e10":"H","e11":"H","e20":"H","e21
":"H"}}'
)
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_e_order
=
True
))
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_
incorrect_position_order_with_ignore_e_order__not_a
(
self
):
def
test_
correct_answer_e1e2_in_e1
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"
test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"H"
,
"e3"
:
"(ep)
"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"
(ep)"
,
"e10"
:
"H"
,
"e11"
:
"H"
,
"e20"
:
"H"
,
"e21"
:
"H
"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"
test","a1":"(ep)","e0":"H","e1":"H","e2":"(ep)","e3
":"H"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"
H","a1":"H","e10":"(ep)","e11":"(ep)","e20":"H","e21
":"H"}}'
)
self
.
assert
False
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_e_order
=
True
))
self
.
assert
True
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_correct_position_order_with_ignore_ae_order
(
self
):
def
test_correct_answer_e1e2_in_e2
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"H"
,
"e3"
:
"(ep)"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"(ep)"
,
"e10"
:
"H"
,
"e11"
:
"H"
,
"e20"
:
"H"
,
"e21"
:
"H"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"test","a1":"(ep)","e0":"H","e1":"H","e2":"(ep)","e3":"H"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"H","a1":"H","e10":"H","e11":"H","e20":"(ep)","e21":"(ep)"}}'
)
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_e_order
=
True
,
ignore_a_order
=
True
))
self
.
assertTrue
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_incorrect_answer_e1e2
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"(ep)"
,
"e10"
:
"H"
,
"e11"
:
"H"
,
"e20"
:
"H"
,
"e21"
:
"H"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"Br","a0":"H","a1":"H","e10":"(ep)","e11":"H","e20":"H","e21":"(ep)"}}'
)
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
test_incorrect_c0
(
self
):
def
test_incorrect_c0
(
self
):
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"H"
,
"e3"
:
"(ep)"
})
correct_answer
=
vsepr_build_correct_answer
(
geometry
=
"AX6E0"
,
atoms
=
{
"c0"
:
"Br"
,
"a0"
:
"(ep)"
,
"a1"
:
"test"
,
"e0"
:
"H"
,
"e1"
:
"H"
,
"e2"
:
"H"
,
"e3"
:
"(ep)"
})
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"H","a0":"test","a1":"(ep)","e0":"H","e1":"H","e2":"(ep)","e3":"H"}}'
)
user_answer
=
vsepr_parse_user_answer
(
u'{"geometry":"AX6E0","atoms":{"c0":"H","a0":"test","a1":"(ep)","e0":"H","e1":"H","e2":"(ep)","e3":"H"}}'
)
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
,
ignore_e_order
=
True
,
ignore_a_order
=
True
))
self
.
assertFalse
(
vsepr_grade
(
user_answer
,
correct_answer
))
def
suite
():
def
suite
():
...
...
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