summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-29 17:31:04 (GMT)
committerGitHub <noreply@github.com>2018-10-29 17:31:04 (GMT)
commit3b05ad7be09af1d4510eb698b0a70d36387f296e (patch)
tree7d4a5ca447ea28c1993ae2a1cdbaa3b4f62a26bb /Lib/test/test_xml_etree.py
parentc93c58b5d560cfe44d9884ff02c9b18e06333360 (diff)
downloadcpython-3b05ad7be09af1d4510eb698b0a70d36387f296e.zip
cpython-3b05ad7be09af1d4510eb698b0a70d36387f296e.tar.gz
cpython-3b05ad7be09af1d4510eb698b0a70d36387f296e.tar.bz2
bpo-34160: Preserve user specified order of Element attributes in html. (GH-10190)
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 9988dad..8a7ec00 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -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):