Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Unified Diff: Lib/test/test_xml_etree.py

Issue 25047: xml.etree.ElementTree encoding declaration should be capital ('UTF-8') rather than lowercase ('utf-8')
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Lib/xml/etree/ElementTree.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_xml_etree.py Tue Sep 15 19:59:03 2015 +0300
+++ b/Lib/test/test_xml_etree.py Fri Sep 18 02:37:40 2015 +0000
@@ -2396,14 +2396,21 @@
elem = ET.Element("tag")
elem.text = "abc"
self.assertEqual(serialize(elem), '<tag>abc</tag>')
- self.assertEqual(serialize(elem, encoding="utf-8"),
- b'<tag>abc</tag>')
- self.assertEqual(serialize(elem, encoding="us-ascii"),
- b'<tag>abc</tag>')
+ for enc in ("utf-8", "us-ascii"):
+ with self.subTest(enc):
+ self.assertEqual(serialize(elem, encoding=enc),
+ b'<tag>abc</tag>')
+ self.assertEqual(serialize(elem, encoding=enc.upper()),
+ b'<tag>abc</tag>')
for enc in ("iso-8859-1", "utf-16", "utf-32"):
- self.assertEqual(serialize(elem, encoding=enc),
- ("<?xml version='1.0' encoding='%s'?>\n"
- "<tag>abc</tag>" % enc).encode(enc))
+ with self.subTest(enc):
+ self.assertEqual(serialize(elem, encoding=enc),
+ ("<?xml version='1.0' encoding='%s'?>\n"
+ "<tag>abc</tag>" % enc).encode(enc))
+ upper = enc.upper()
+ self.assertEqual(serialize(elem, encoding=upper),
+ ("<?xml version='1.0' encoding='%s'?>\n"
+ "<tag>abc</tag>" % upper).encode(enc))
elem = ET.Element("tag")
elem.text = "<&\"\'>"
« no previous file with comments | « no previous file | Lib/xml/etree/ElementTree.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+