summaryrefslogtreecommitdiffstats
path: root/Lib/test/multibytecodec_support.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-12-02 18:04:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-12-02 18:04:37 (GMT)
commita2816c2b11aeb24b232570b4073a9644bfdd82c7 (patch)
treed447b9f1b48bba68bf0b45b18d5c1ec313f2b86d /Lib/test/multibytecodec_support.py
parent2f560fa3009b8b6d4e64eec4c1e7d201b5ed7035 (diff)
downloadcpython-a2816c2b11aeb24b232570b4073a9644bfdd82c7.zip
cpython-a2816c2b11aeb24b232570b4073a9644bfdd82c7.tar.gz
cpython-a2816c2b11aeb24b232570b4073a9644bfdd82c7.tar.bz2
more test to more general test file, so it can test more things
Diffstat (limited to 'Lib/test/multibytecodec_support.py')
-rw-r--r--Lib/test/multibytecodec_support.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py
index 5f08f10..26bac7b 100644
--- a/Lib/test/multibytecodec_support.py
+++ b/Lib/test/multibytecodec_support.py
@@ -108,6 +108,13 @@ class TestBase:
self.assertEqual(self.encode(sin,
"test.xmlcharnamereplace")[0], sout)
+ def test_callback_returns_bytes(self):
+ def myreplace(exc):
+ return (b"1234", exc.end)
+ codecs.register_error("test.cjktest", myreplace)
+ enc = self.encode("abc" + self.unmappedunicode + "def", "test.cjktest")[0]
+ self.assertEqual(enc, b"abc1234def")
+
def test_callback_wrong_objects(self):
def myreplace(exc):
return (ret, exc.end)