summaryrefslogtreecommitdiff
path: root/Lib/test/test_multibytecodec.py
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2009-04-02 10:33:16 +0000
committerHye-Shik Chang <hyeshik@gmail.com>2009-04-02 10:33:16 +0000
commit944820b044ce3944dcef1b514e075118f6872942 (patch)
tree4bb9c95bc039e479a750d616bafa227fa9e64ff3 /Lib/test/test_multibytecodec.py
parenta3d056ed95ff45dbd8abd90f3f816e7953214d80 (diff)
downloadcpython-git-944820b044ce3944dcef1b514e075118f6872942.tar.gz
Issue #5640: Fix _multibytecodec so that CJK codecs don't repeat
error replacement returned by codec error callbacks twice in IncrementalEncoder and StreamWriter.
Diffstat (limited to 'Lib/test/test_multibytecodec.py')
-rw-r--r--Lib/test/test_multibytecodec.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index 2f648675c2..1d9d9e35eb 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -112,6 +112,10 @@ class Test_IncrementalEncoder(unittest.TestCase):
self.assertRaises(UnicodeEncodeError, encoder.encode, '\u0123')
self.assertEqual(encoder.encode('', True), b'\xa9\xdc')
+ def test_issue5640(self):
+ encoder = codecs.getincrementalencoder('shift-jis')('backslashreplace')
+ self.assertEqual(encoder.encode('\xff'), b'\\xff')
+ self.assertEqual(encoder.encode('\n'), b'\n')
class Test_IncrementalDecoder(unittest.TestCase):