diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-02-09 17:08:05 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-02-09 17:08:05 (GMT) |
commit | 42fb6ab49128f14cd353ec86a177ddda6763812e (patch) | |
tree | a2a56b68bc65883013bd8cc14cb40a53a1e9d6c6 /Lib/test/test_xml_etree.py | |
parent | 7b5aa463f99f600803207ea4bc1aa63b4befdd7d (diff) | |
download | cpython-42fb6ab49128f14cd353ec86a177ddda6763812e.zip cpython-42fb6ab49128f14cd353ec86a177ddda6763812e.tar.gz cpython-42fb6ab49128f14cd353ec86a177ddda6763812e.tar.bz2 |
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.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 2ccb77a..8cdd4ee 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -213,6 +213,23 @@ def check_encoding(ET, encoding): """ ET.XML("<?xml version='1.0' encoding='%s'?><xml />" % encoding) +def processinginstruction(): + """ + 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&>?>' + + """ # # xinclude tests (samples from appendix C of the xinclude specification) |