summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-02-09 17:25:47 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-02-09 17:25:47 (GMT)
commit99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8 (patch)
treedb02a09b57b68dbc4fa0a2162535135fd99ed20a /Lib/test/test_xml_etree.py
parentc77dd32be4557ad5d2e5c9a710ebeaf52d5092d1 (diff)
downloadcpython-99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8.zip
cpython-99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8.tar.gz
cpython-99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8.tar.bz2
Merged revisions 78125 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78125 | antoine.pitrou | 2010-02-09 18:08:05 +0100 (mar., 09 févr. 2010) | 7 lines Issue #2746: Don't escape ampersands and angle brackets ("&", "<", ">") in XML processing instructions and comments. These raw characters are allowed by the XML specification, and are necessary when outputting e.g. PHP code in a processing instruction. Patch by Neil Muller. ........
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index a7ad48b..3df1896 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -210,6 +210,26 @@ def check_encoding(ET, encoding):
"""
ET.XML("<?xml version='1.0' encoding='%s'?><xml />" % encoding)
+def processinginstruction():
+ r"""
+ Test ProcessingInstruction directly
+
+ >>> from xml.etree import ElementTree as ET
+
+ >>> ET.tostring(ET.ProcessingInstruction('test', 'instruction'))
+ '<?test instruction?>'
+ >>> ET.tostring(ET.PI('test', 'instruction'))
+ '<?test instruction?>'
+
+ Issue #2746
+
+ >>> ET.tostring(ET.PI('test', '<testing&>'))
+ '<?test <testing&>?>'
+ >>> ET.tostring(ET.PI('test', '<testing&>\xe3'), 'latin1')
+ b"<?xml version='1.0' encoding='latin1'?>\n<?test <testing&>\xe3?>"
+
+ """
+
def check_issue6233():
"""
>>> from xml.etree import ElementTree as ET