diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-15 21:44:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-15 21:44:05 (GMT) |
commit | 040e16e3e8146f07fedd1ca73922a242d673fd56 (patch) | |
tree | b797f3abf0d90620e27cc0775ffce39a65ba7dd3 /Lib/test/test_codeccallbacks.py | |
parent | 8ab440e4771c4118e874cbb05b5f8f09a4408f49 (diff) | |
download | cpython-040e16e3e8146f07fedd1ca73922a242d673fd56.zip cpython-040e16e3e8146f07fedd1ca73922a242d673fd56.tar.gz cpython-040e16e3e8146f07fedd1ca73922a242d673fd56.tar.bz2 |
"unicode_internal" codec has been deprecated: fix related tests
Diffstat (limited to 'Lib/test/test_codeccallbacks.py')
-rw-r--r-- | Lib/test/test_codeccallbacks.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py index d654a3f..0e62890 100644 --- a/Lib/test/test_codeccallbacks.py +++ b/Lib/test/test_codeccallbacks.py @@ -1,5 +1,10 @@ -import test.support, unittest -import sys, codecs, html.entities, unicodedata +import codecs +import html.entities +import sys +import test.support +import unicodedata +import unittest +import warnings try: import ctypes @@ -621,12 +626,15 @@ class CodecCallbackTest(unittest.TestCase): ("utf-7", b"+x-"), ("unicode-internal", b"\x00"), ): - self.assertRaises( - TypeError, - bytes.decode, - enc, - "test.badhandler" - ) + with warnings.catch_warnings(): + # unicode-internal has been deprecated + warnings.simplefilter("ignore", DeprecationWarning) + self.assertRaises( + TypeError, + bytes.decode, + enc, + "test.badhandler" + ) def test_lookup(self): self.assertEqual(codecs.strict_errors, codecs.lookup_error("strict")) @@ -842,8 +850,11 @@ class CodecCallbackTest(unittest.TestCase): else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error("test.replacing", replacing) - for (encoding, data) in baddata: - self.assertRaises(TypeError, data.decode, encoding, "test.replacing") + with warnings.catch_warnings(): + # unicode-internal has been deprecated + warnings.simplefilter("ignore", DeprecationWarning) + for (encoding, data) in baddata: + self.assertRaises(TypeError, data.decode, encoding, "test.replacing") def mutating(exc): if isinstance(exc, UnicodeDecodeError): |