Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3b05ad7b
Commit
3b05ad7b
authored
Oct 29, 2018
by
Serhiy Storchaka
Committed by
GitHub
Oct 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34160: Preserve user specified order of Element attributes in html. (GH-10190)
parent
c93c58b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree.py
+4
-8
Lib/xml/etree/ElementTree.py
Lib/xml/etree/ElementTree.py
+1
-1
No files found.
Lib/test/test_xml_etree.py
View file @
3b05ad7b
...
...
@@ -5,7 +5,6 @@
# For this purpose, the module-level "ET" symbol is temporarily
# monkey-patched when running the "test_xml_etree_c" test suite.
import
contextlib
import
copy
import
functools
import
html
...
...
@@ -1056,13 +1055,10 @@ class ElementTreeTest(unittest.TestCase):
def
test_tree_write_attribute_order
(
self
):
# See BPO 34160
root
=
ET
.
Element
(
'cirriculum'
,
status
=
'public'
,
company
=
'example'
)
tree
=
ET
.
ElementTree
(
root
)
f
=
io
.
BytesIO
()
with
contextlib
.
redirect_stdout
(
f
):
tree
.
write
(
f
,
encoding
=
'utf-8'
,
xml_declaration
=
True
)
self
.
assertEqual
(
f
.
getvalue
(),
b"<?xml version='1.0' encoding='utf-8'?>
\
n
"
b'<cirriculum status="public" company="example" />'
)
self
.
assertEqual
(
serialize
(
root
),
'<cirriculum status="public" company="example" />'
)
self
.
assertEqual
(
serialize
(
root
,
method
=
'html'
),
'<cirriculum status="public" company="example"></cirriculum>'
)
class
XMLPullParserTest
(
unittest
.
TestCase
):
...
...
Lib/xml/etree/ElementTree.py
View file @
3b05ad7b
...
...
@@ -979,7 +979,7 @@ def _serialize_html(write, elem, qnames, namespaces, **kwargs):
k
,
_escape_attrib
(
v
)
))
for
k
,
v
in
sorted
(
items
):
# lexical order
for
k
,
v
in
items
:
if
isinstance
(
k
,
QName
):
k
=
k
.
text
if
isinstance
(
v
,
QName
):
...
...
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