[Python-checkins] python/dist/src/Lib/test test_minidom.py, 1.39.4.1, 1.39.4.2

birkenfeld@users.sourceforge.net birkenfeld at users.sourceforge.net
Fri Aug 26 00:14:31 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26266/Lib/test

Modified Files:
      Tag: release24-maint
	test_minidom.py 
Log Message:
backport bug [ 1262320 ] minidom.py alternate newl support is broken



Index: test_minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v
retrieving revision 1.39.4.1
retrieving revision 1.39.4.2
diff -u -d -r1.39.4.1 -r1.39.4.2
--- test_minidom.py	22 Jul 2005 21:48:49 -0000	1.39.4.1
+++ test_minidom.py	25 Aug 2005 22:14:21 -0000	1.39.4.2
@@ -413,12 +413,19 @@
 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 testEncodings():
     doc = parseString('<foo>&#x20ac;</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()
 



More information about the Python-checkins mailing list