diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-11-17 10:23:34 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-11-17 10:23:34 (GMT) |
commit | adc417ce361282927bb580830a9568810874a9bc (patch) | |
tree | 931b2ebed072febfdc1bcf2173bf594f87cfe889 /Lib/test/test_codecs.py | |
parent | 5a8bc6f7f9bd58a08032e3712dd321f254c864d8 (diff) | |
download | cpython-adc417ce361282927bb580830a9568810874a9bc.zip cpython-adc417ce361282927bb580830a9568810874a9bc.tar.gz cpython-adc417ce361282927bb580830a9568810874a9bc.tar.bz2 |
#13406: fix more deprecation warnings and move the deprecation of unicode-internal earlier in the code.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index cbcf18b..e885a5a 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -1062,10 +1062,8 @@ class UnicodeInternalTest(unittest.TestCase): self.assertEqual(("ab", 12), ignored) def test_encode_length(self): - with warnings.catch_warnings(): - # unicode-internal has been deprecated - warnings.simplefilter("ignore", DeprecationWarning) - + with support.check_warnings(('unicode_internal codec has been ' + 'deprecated', DeprecationWarning)): # Issue 3739 encoder = codecs.getencoder("unicode_internal") self.assertEqual(encoder("a")[1], 1) @@ -1528,10 +1526,8 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling): name = "latin_1" self.assertEqual(encoding.replace("_", "-"), name.replace("_", "-")) - with warnings.catch_warnings(): + with support.check_warnings(): # unicode-internal has been deprecated - warnings.simplefilter("ignore", DeprecationWarning) - (b, size) = codecs.getencoder(encoding)(s) self.assertEqual(size, len(s), "%r != %r (encoding=%r)" % (size, len(s), encoding)) (chars, size) = codecs.getdecoder(encoding)(b) @@ -1639,7 +1635,9 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling): def test_bad_encode_args(self): for encoding in all_unicode_encodings: encoder = codecs.getencoder(encoding) - self.assertRaises(TypeError, encoder) + with support.check_warnings(): + # unicode-internal has been deprecated + self.assertRaises(TypeError, encoder) def test_encoding_map_type_initialized(self): from encodings import cp1140 |