diff options
author | Georg Brandl <georg@python.org> | 2005-08-25 22:14:21 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-08-25 22:14:21 (GMT) |
commit | 296681e105e0c1a9b3f42fc540cd2a982665da8c (patch) | |
tree | 358a3263183729fe55c0970a21bc7e7f2b203d97 | |
parent | 900a84a5a6cc1f415698e227d5de427ce001e31e (diff) | |
download | cpython-296681e105e0c1a9b3f42fc540cd2a982665da8c.zip cpython-296681e105e0c1a9b3f42fc540cd2a982665da8c.tar.gz cpython-296681e105e0c1a9b3f42fc540cd2a982665da8c.tar.bz2 |
backport bug [ 1262320 ] minidom.py alternate newl support is broken
-rw-r--r-- | Lib/test/test_minidom.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 15581cc..3154fbf 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -413,12 +413,19 @@ def testAttributeRepr(): def testTextNodeRepr(): pass def testWriteXML(): - str = '<?xml version="1.0" ?>\n<a b="c"/>' + str = '<?xml version="1.0" ?><a b="c"/>' dom = parseString(str) domstr = dom.toxml() dom.unlink() confirm(str == domstr) +def testAltNewline(): + str = '<?xml version="1.0" ?>\n<a b="c"/>\n' + dom = parseString(str) + domstr = dom.toprettyxml(newl="\r\n") + dom.unlink() + confirm(domstr == str.replace("\n", "\r\n")) + def testProcessingInstruction(): dom = parseString('<e><?mypi \t\n data \t\n ?></e>') pi = dom.documentElement.firstChild @@ -878,9 +885,9 @@ def testSAX2DOM(): def testEncodings(): doc = parseString('<foo>€</foo>') - confirm(doc.toxml() == u'<?xml version="1.0" ?>\n<foo>\u20ac</foo>' - and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n<foo>\xe2\x82\xac</foo>' - and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?>\n<foo>\xa4</foo>', + confirm(doc.toxml() == u'<?xml version="1.0" ?><foo>\u20ac</foo>' + and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?><foo>\xe2\x82\xac</foo>' + and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?><foo>\xa4</foo>', "testEncodings - encoding EURO SIGN") doc.unlink() |