We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 121a6b1 commit 604dc15Copy full SHA for 604dc15
Lib/test/test_xml_etree.py
@@ -464,6 +464,16 @@ def test_makeelement(self):
464
elem[:] = tuple([subelem])
465
self.serialize_check(elem, '<tag><subtag key="value" /></tag>')
466
467
+ def test_parse_encoding_warn(self):
468
+ with self.assertWarns(RuntimeWarning) as cm:
469
+ with open(SIMPLE_XMLFILE, 'r', encoding='ISO-8859-1') as fp:
470
+ ET.parse(fp)
471
+ self.assertIn(
472
+ "For file objects containing XML data"
473
+ "with non-ASCII and non-UTF-8 encoding (e.g. ISO 8859-1), "
474
+ "the file must have been opened in binary mode.",
475
+ str(cm.warnings[0].message))
476
+
477
def test_parsefile(self):
478
# Test parsing from file.
479
0 commit comments