Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
4f63fb69
Commit
4f63fb69
authored
Feb 28, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pretty-print XML in Studio edit
parent
ec889c39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
apps/openassessment/xblock/test/test_xml.py
+13
-2
apps/openassessment/xblock/xml.py
+1
-1
No files found.
apps/openassessment/xblock/test/test_xml.py
View file @
4f63fb69
...
...
@@ -77,6 +77,11 @@ class TestSerializeContent(TestCase):
# instead of a test failure.
parsed_expected
=
etree
.
fromstring
(
""
.
join
(
data
[
'expected_xml'
]))
# Pretty-print and reparse the expected XML
pretty_expected
=
etree
.
tostring
(
parsed_expected
,
pretty_print
=
True
,
encoding
=
'utf-8'
)
parsed_expected
=
etree
.
fromstring
(
pretty_expected
)
# Walk both trees, comparing elements and attributes
actual_elements
=
[
el
for
el
in
parsed_actual
.
getiterator
()]
expected_elements
=
[
el
for
el
in
parsed_expected
.
getiterator
()]
...
...
@@ -88,8 +93,14 @@ class TestSerializeContent(TestCase):
for
actual
,
expected
in
zip
(
actual_elements
,
expected_elements
):
self
.
assertEqual
(
actual
.
tag
,
expected
.
tag
)
self
.
assertEqual
(
actual
.
text
,
expected
.
text
)
self
.
assertItemsEqual
(
actual
.
items
(),
expected
.
items
())
self
.
assertEqual
(
actual
.
text
,
expected
.
text
,
msg
=
"Incorrect text for {tag}"
.
format
(
tag
=
actual
.
tag
)
)
self
.
assertItemsEqual
(
actual
.
items
(),
expected
.
items
(),
msg
=
"Incorrect attributes for {tag}"
.
format
(
tag
=
actual
.
tag
)
)
def
test_mutated_criteria_dict
(
self
):
self
.
oa_block
.
title
=
"Test title"
...
...
apps/openassessment/xblock/xml.py
View file @
4f63fb69
...
...
@@ -429,7 +429,7 @@ def serialize_content(oa_block):
_serialize_rubric
(
rubric_root
,
oa_block
)
# Return a UTF-8 representation of the XML
return
etree
.
tostring
(
root
,
encoding
=
'utf-8'
)
return
etree
.
tostring
(
root
,
pretty_print
=
True
,
encoding
=
'utf-8'
)
def
update_from_xml
(
...
...
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