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
b42c4dac
Commit
b42c4dac
authored
Apr 16, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for "radio" choicegroup
parent
a3233b67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
lms/djangoapps/courseware/features/problems.feature
+5
-0
lms/djangoapps/courseware/features/problems.py
+25
-1
No files found.
lms/djangoapps/courseware/features/problems.feature
View file @
b42c4dac
...
@@ -15,6 +15,7 @@ Feature: Answer problems
...
@@ -15,6 +15,7 @@ Feature: Answer problems
|
drop
down
|
|
drop
down
|
|
multiple
choice
|
|
multiple
choice
|
|
checkbox
|
|
checkbox
|
|
radio
|
|
string
|
|
string
|
|
numerical
|
|
numerical
|
|
formula
|
|
formula
|
...
@@ -33,6 +34,7 @@ Feature: Answer problems
...
@@ -33,6 +34,7 @@ Feature: Answer problems
|
drop
down
|
|
drop
down
|
|
multiple
choice
|
|
multiple
choice
|
|
checkbox
|
|
checkbox
|
|
radio
|
|
string
|
|
string
|
|
numerical
|
|
numerical
|
|
formula
|
|
formula
|
...
@@ -50,6 +52,7 @@ Feature: Answer problems
...
@@ -50,6 +52,7 @@ Feature: Answer problems
|
drop
down
|
|
drop
down
|
|
multiple
choice
|
|
multiple
choice
|
|
checkbox
|
|
checkbox
|
|
radio
|
|
string
|
|
string
|
|
numerical
|
|
numerical
|
|
formula
|
|
formula
|
...
@@ -71,6 +74,8 @@ Feature: Answer problems
...
@@ -71,6 +74,8 @@ Feature: Answer problems
|
multiple
choice
|
incorrect
|
|
multiple
choice
|
incorrect
|
|
checkbox
|
correct
|
|
checkbox
|
correct
|
|
checkbox
|
incorrect
|
|
checkbox
|
incorrect
|
|
radio
|
correct
|
|
radio
|
incorrect
|
|
string
|
correct
|
|
string
|
correct
|
|
string
|
incorrect
|
|
string
|
incorrect
|
|
numerical
|
correct
|
|
numerical
|
correct
|
...
...
lms/djangoapps/courseware/features/problems.py
View file @
b42c4dac
...
@@ -42,7 +42,13 @@ PROBLEM_FACTORY_DICT = {
...
@@ -42,7 +42,13 @@ PROBLEM_FACTORY_DICT = {
'choice_type'
:
'checkbox'
,
'choice_type'
:
'checkbox'
,
'choices'
:
[
True
,
False
,
True
,
False
,
False
],
'choices'
:
[
True
,
False
,
True
,
False
,
False
],
'choice_names'
:
[
'Choice 1'
,
'Choice 2'
,
'Choice 3'
,
'Choice 4'
]}},
'choice_names'
:
[
'Choice 1'
,
'Choice 2'
,
'Choice 3'
,
'Choice 4'
]}},
'radio'
:
{
'factory'
:
ChoiceResponseXMLFactory
(),
'kwargs'
:
{
'question_text'
:
'The correct answer is Choice 3'
,
'choice_type'
:
'radio'
,
'choices'
:
[
False
,
False
,
True
,
False
],
'choice_names'
:
[
'Choice 1'
,
'Choice 2'
,
'Choice 3'
,
'Choice 4'
]}},
'string'
:
{
'string'
:
{
'factory'
:
StringResponseXMLFactory
(),
'factory'
:
StringResponseXMLFactory
(),
'kwargs'
:
{
'kwargs'
:
{
...
@@ -174,6 +180,12 @@ def answer_problem(step, problem_type, correctness):
...
@@ -174,6 +180,12 @@ def answer_problem(step, problem_type, correctness):
else
:
else
:
inputfield
(
'checkbox'
,
choice
=
'choice_3'
)
.
check
()
inputfield
(
'checkbox'
,
choice
=
'choice_3'
)
.
check
()
elif
problem_type
==
'radio'
:
if
correctness
==
'correct'
:
inputfield
(
'radio'
,
choice
=
'choice_2'
)
.
check
()
else
:
inputfield
(
'radio'
,
choice
=
'choice_1'
)
.
check
()
elif
problem_type
==
'string'
:
elif
problem_type
==
'string'
:
textvalue
=
'correct string'
if
correctness
==
'correct'
\
textvalue
=
'correct string'
if
correctness
==
'correct'
\
else
'incorrect'
else
'incorrect'
...
@@ -252,6 +264,14 @@ def assert_problem_has_answer(step, problem_type, answer_class):
...
@@ -252,6 +264,14 @@ def assert_problem_has_answer(step, problem_type, answer_class):
else
:
else
:
assert_checked
(
'checkbox'
,
[])
assert_checked
(
'checkbox'
,
[])
elif
problem_type
==
"radio"
:
if
answer_class
==
'correct'
:
assert_checked
(
'radio'
,
[
'choice_2'
])
elif
answer_class
==
'incorrect'
:
assert_checked
(
'radio'
,
[
'choice_1'
])
else
:
assert_checked
(
'radio'
,
[])
elif
problem_type
==
'string'
:
elif
problem_type
==
'string'
:
if
answer_class
==
'blank'
:
if
answer_class
==
'blank'
:
expected
=
''
expected
=
''
...
@@ -298,6 +318,7 @@ CORRECTNESS_SELECTORS = {
...
@@ -298,6 +318,7 @@ CORRECTNESS_SELECTORS = {
'correct'
:
{
'drop down'
:
[
'span.correct'
],
'correct'
:
{
'drop down'
:
[
'span.correct'
],
'multiple choice'
:
[
'label.choicegroup_correct'
],
'multiple choice'
:
[
'label.choicegroup_correct'
],
'checkbox'
:
[
'span.correct'
],
'checkbox'
:
[
'span.correct'
],
'radio'
:
[
'label.choicegroup_correct'
],
'string'
:
[
'div.correct'
],
'string'
:
[
'div.correct'
],
'numerical'
:
[
'div.correct'
],
'numerical'
:
[
'div.correct'
],
'formula'
:
[
'div.correct'
],
'formula'
:
[
'div.correct'
],
...
@@ -308,6 +329,8 @@ CORRECTNESS_SELECTORS = {
...
@@ -308,6 +329,8 @@ CORRECTNESS_SELECTORS = {
'multiple choice'
:
[
'label.choicegroup_incorrect'
,
'multiple choice'
:
[
'label.choicegroup_incorrect'
,
'span.incorrect'
],
'span.incorrect'
],
'checkbox'
:
[
'span.incorrect'
],
'checkbox'
:
[
'span.incorrect'
],
'radio'
:
[
'label.choicegroup_incorrect'
,
'span.incorrect'
],
'string'
:
[
'div.incorrect'
],
'string'
:
[
'div.incorrect'
],
'numerical'
:
[
'div.incorrect'
],
'numerical'
:
[
'div.incorrect'
],
'formula'
:
[
'div.incorrect'
],
'formula'
:
[
'div.incorrect'
],
...
@@ -317,6 +340,7 @@ CORRECTNESS_SELECTORS = {
...
@@ -317,6 +340,7 @@ CORRECTNESS_SELECTORS = {
'unanswered'
:
{
'drop down'
:
[
'span.unanswered'
],
'unanswered'
:
{
'drop down'
:
[
'span.unanswered'
],
'multiple choice'
:
[
'span.unanswered'
],
'multiple choice'
:
[
'span.unanswered'
],
'checkbox'
:
[
'span.unanswered'
],
'checkbox'
:
[
'span.unanswered'
],
'radio'
:
[
'span.unanswered'
],
'string'
:
[
'div.unanswered'
],
'string'
:
[
'div.unanswered'
],
'numerical'
:
[
'div.unanswered'
],
'numerical'
:
[
'div.unanswered'
],
'formula'
:
[
'div.unanswered'
],
'formula'
:
[
'div.unanswered'
],
...
...
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