diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-09-18 21:42:35 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-09-18 21:42:35 (GMT) |
commit | 308d637c94b9ed88c386b83891ad38b2131ebd12 (patch) | |
tree | da0e7c3d9999e3c0a3dbc02fb4be7fbffba5ed7e /Lib/test | |
parent | 7a4e5866f70ccbb76dae6e0139f5ddba8bc5761a (diff) | |
download | cpython-308d637c94b9ed88c386b83891ad38b2131ebd12.zip cpython-308d637c94b9ed88c386b83891ad38b2131ebd12.tar.gz cpython-308d637c94b9ed88c386b83891ad38b2131ebd12.tar.bz2 |
Merged revisions 74929 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74929 | benjamin.peterson | 2009-09-18 16:14:55 -0500 (Fri, 18 Sep 2009) | 1 line
add keyword arguments support to str/unicode encode and decode #6300
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_bytes.py | 2 | ||||
-rw-r--r-- | Lib/test/test_unicode.py | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index dd01b93..ad11686 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -186,6 +186,8 @@ class BaseBytesTest(unittest.TestCase): b = self.type2test(sample, "latin1") self.assertRaises(UnicodeDecodeError, b.decode, "utf8") self.assertEqual(b.decode("utf8", "ignore"), "Hello world\n") + self.assertEqual(b.decode(errors="ignore", encoding="utf8"), + "Hello world\n") def test_from_int(self): b = self.type2test(0) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 7f87b43..66368f4 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -955,6 +955,10 @@ class UnicodeTest( self.assertRaises(UnicodeError, 'Andr\202 x'.encode, 'ascii','strict') self.assertEqual('Andr\202 x'.encode('ascii','ignore'), b"Andr x") self.assertEqual('Andr\202 x'.encode('ascii','replace'), b"Andr? x") + self.assertEqual('Andr\202 x'.encode('ascii', 'replace'), + 'Andr\202 x'.encode('ascii', errors='replace')) + self.assertEqual('Andr\202 x'.encode('ascii', 'ignore'), + 'Andr\202 x'.encode(encoding='ascii', errors='ignore')) # Error handling (decoding) self.assertRaises(UnicodeError, str, b'Andr\202 x', 'ascii') |