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
3ad2f092
Commit
3ad2f092
authored
Jun 29, 2016
by
Hamza Munir
Committed by
hamzamunir7300
Jun 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tnl-4141 only whitespaces not allowed in answer and fixed the pep8 violation.
parent
d328328f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
common/lib/capa/capa/responsetypes.py
+4
-1
common/lib/capa/capa/tests/test_responsetypes.py
+4
-4
No files found.
common/lib/capa/capa/responsetypes.py
View file @
3ad2f092
...
...
@@ -189,7 +189,10 @@ class LoncapaResponse(object):
raise
LoncapaProblemError
(
msg
)
for
prop
in
self
.
required_attributes
:
if
not
xml
.
get
(
prop
):
prop_value
=
xml
.
get
(
prop
)
if
prop_value
:
# Stripping off the empty strings
prop_value
=
prop_value
.
strip
()
if
not
prop_value
:
msg
=
"Error in problem specification:
%
s missing required attribute
%
s"
%
(
unicode
(
self
),
prop
)
msg
+=
"
\n
See XML source line
%
s"
%
getattr
(
...
...
common/lib/capa/capa/tests/test_responsetypes.py
View file @
3ad2f092
...
...
@@ -946,12 +946,12 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring
hint
=
correct_map
.
get_hint
(
'1_2_1'
)
self
.
assertEqual
(
hint
,
self
.
_get_random_number_result
(
problem
.
seed
))
def
test_empty_answer_
graded_as_incorrect
(
self
):
def
test_empty_answer_
problem_creation_not_allowed
(
self
):
"""
Tests that
problem should be graded incorrect if blank space is chosen as answer
Tests that
empty answer string is not allowed to create a problem
"""
problem
=
self
.
build_problem
(
answer
=
" "
,
case_sensitive
=
False
,
regexp
=
True
)
self
.
assert_grade
(
problem
,
u" "
,
"incorrect"
)
with
self
.
assertRaises
(
LoncapaProblemError
):
self
.
build_problem
(
answer
=
" "
,
case_sensitive
=
False
,
regexp
=
True
)
class
CodeResponseTest
(
ResponseTest
):
# pylint: disable=missing-docstring
...
...
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