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
ab9b661f
Commit
ab9b661f
authored
Sep 19, 2012
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#15970: merge with 3.2.
parents
da064d07
c90111f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree.py
+12
-0
Lib/xml/etree/ElementTree.py
Lib/xml/etree/ElementTree.py
+1
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_xml_etree.py
View file @
ab9b661f
...
...
@@ -1809,6 +1809,18 @@ class ElementTreeTest(unittest.TestCase):
mye
=
MyElement
(
'joe'
)
self
.
assertEqual
(
mye
.
newmethod
(),
'joe'
)
def
test_html_empty_elems_serialization
(
self
):
# issue 15970
# from http://www.w3.org/TR/html401/index/elements.html
for
element
in
[
'AREA'
,
'BASE'
,
'BASEFONT'
,
'BR'
,
'COL'
,
'FRAME'
,
'HR'
,
'IMG'
,
'INPUT'
,
'ISINDEX'
,
'LINK'
,
'META'
,
'PARAM'
]:
for
elem
in
[
element
,
element
.
lower
()]:
expected
=
'<%s>'
%
elem
serialized
=
serialize
(
ET
.
XML
(
'<%s />'
%
elem
),
method
=
'html'
)
self
.
assertEqual
(
serialized
,
expected
)
serialized
=
serialize
(
ET
.
XML
(
'<%s></%s>'
%
(
elem
,
elem
)),
method
=
'html'
)
self
.
assertEqual
(
serialized
,
expected
)
class
ElementIterTest
(
unittest
.
TestCase
):
def
_ilist
(
self
,
elem
,
tag
=
None
):
...
...
Lib/xml/etree/ElementTree.py
View file @
ab9b661f
...
...
@@ -995,7 +995,7 @@ def _serialize_xml(write, elem, qnames, namespaces):
write
(
_escape_cdata
(
elem
.
tail
))
HTML_EMPTY
=
(
"area"
,
"base"
,
"basefont"
,
"br"
,
"col"
,
"frame"
,
"hr"
,
"img"
,
"input"
,
"isindex"
,
"link"
,
"meta"
"param"
)
"img"
,
"input"
,
"isindex"
,
"link"
,
"meta"
,
"param"
)
try
:
HTML_EMPTY
=
set
(
HTML_EMPTY
)
...
...
Misc/NEWS
View file @
ab9b661f
...
...
@@ -32,6 +32,9 @@ Core and Builtins
Library
-------
- Issue #15970: xml.etree.ElementTree now serializes correctly the empty HTML
elements '
meta
' and '
param
'.
- Issue #15842: the SocketIO.{readable,writable,seekable} methods now
raise ValueError when the file-like object is closed. Patch by Alessandro
Moura.
...
...
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