diff options
author | Guido van Rossum <guido@python.org> | 2007-07-27 18:03:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-27 18:03:11 (GMT) |
commit | 3e1f85eb5d20098dd98c941394b2f781dee957d3 (patch) | |
tree | d60e53f916c52ea5e363eb13701e478395726254 /Lib/test | |
parent | 3992db81b6c4050a26f7e242b1f16fee245b3127 (diff) | |
download | cpython-3e1f85eb5d20098dd98c941394b2f781dee957d3.zip cpython-3e1f85eb5d20098dd98c941394b2f781dee957d3.tar.gz cpython-3e1f85eb5d20098dd98c941394b2f781dee957d3.tar.bz2 |
Fix the minidom test.
In order to do this, I added an optional encoding argument to io.StringIO.
The toprettyxml() function returns bytes when you specify an encoding now.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_minidom.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 9b61d1a..cc637d0 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -869,17 +869,17 @@ class MinidomTest(unittest.TestCase): def testEncodings(self): doc = parseString('<foo>€</foo>') - self.confirm(doc.toxml() == '<?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") + self.assertEqual(doc.toxml(), + '<?xml version="1.0" ?><foo>\u20ac</foo>') + self.assertEqual(doc.toxml('utf-8'), + b'<?xml version="1.0" encoding="utf-8"?><foo>\xe2\x82\xac</foo>') + self.assertEqual(doc.toxml('iso-8859-15'), + b'<?xml version="1.0" encoding="iso-8859-15"?><foo>\xa4</foo>') # Verify that character decoding errors throw exceptions instead # of crashing self.assertRaises(UnicodeDecodeError, parseString, - '<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>') + b'<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>') doc.unlink() |