[Python-checkins] cpython (3.3): more test to more general test file, so it can test more things
benjamin.peterson
python-checkins at python.org
Sun Dec 2 19:04:51 CET 2012
http://hg.python.org/cpython/rev/03ce83e43e1b
changeset: 80699:03ce83e43e1b
branch: 3.3
parent: 80697:72623edae4df
user: Benjamin Peterson <benjamin at python.org>
date: Sun Dec 02 13:04:37 2012 -0500
summary:
more test to more general test file, so it can test more things
files:
Lib/test/multibytecodec_support.py | 7 +++++++
Lib/test/test_multibytecodec.py | 4 ----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py
--- a/Lib/test/multibytecodec_support.py
+++ b/Lib/test/multibytecodec_support.py
@@ -108,6 +108,13 @@
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)
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -45,10 +45,6 @@
self.assertRaises(IndexError, dec,
b'apple\x92ham\x93spam', 'test.cjktest')
- def test_errorhandler_returns_bytes(self):
- enc = "\u30fb\udc80".encode('gb18030', 'surrogateescape')
- self.assertEqual(enc, b'\x819\xa79\x80')
-
def test_codingspec(self):
try:
for enc in ALL_CJKENCODINGS:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list