Index: Lib/test/test_minidom.py =================================================================== --- Lib/test/test_minidom.py (revision 72551) +++ Lib/test/test_minidom.py (working copy) @@ -1480,6 +1480,28 @@ doc.appendChild(doc.createComment("foo--bar")) self.assertRaises(ValueError, doc.toxml) + def testMultilineAttrRoundtrip(self): + value = "multiline\nvalue" + test = "testMultilineAttrRoundtrip" + + dom = Document() + child = dom.appendChild(dom.createElement("abc")) + + child.setAttribute("def", value) + self.confirm(child.getAttribute("def") == value) + self.confirm(child.attributes["def"].value == value) + + parsed = parseString(dom.toxml()) + pchild = parsed.firstChild + + self.confirm(pchild.getAttribute("def") == value, test) + self.confirm(pchild.attributes["def"].value == value, test) + self.confirm(child.toxml() == pchild.toxml(), test) + self.confirm(dom.toxml() == parsed.toxml(), test) + + dom.unlink() + parsed.unlink() + def test_main(): run_unittest(MinidomTest)