diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-02-20 21:56:01 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-02-20 21:56:01 (GMT) |
commit | 51e243f22ef1dcfcbed18374078d37acfc79ab81 (patch) | |
tree | a059831d9c33571b9118c7d7d50e3a0a341e2bae /Lib/test/test_unicode.py | |
parent | 795c10b3b60d14e5c10ba82fe4047aa54978fe93 (diff) | |
download | cpython-51e243f22ef1dcfcbed18374078d37acfc79ab81.zip cpython-51e243f22ef1dcfcbed18374078d37acfc79ab81.tar.gz cpython-51e243f22ef1dcfcbed18374078d37acfc79ab81.tar.bz2 |
Silence DeprecationWarnings in test_unicode.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index f7d8686..d4e2222 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2172,15 +2172,17 @@ class UnicodeTest(string_tests.CommonTest, # generate a fresh string (refcount=1) text = 'a' * length + 'b' - # fill wstr internal field - abc = text.encode('unicode_internal') - self.assertEqual(abc.decode('unicode_internal'), text) - - # resize text: wstr field must be cleared and then recomputed - text += 'c' - abcdef = text.encode('unicode_internal') - self.assertNotEqual(abc, abcdef) - self.assertEqual(abcdef.decode('unicode_internal'), text) + with support.check_warnings(('unicode_internal codec has been ' + 'deprecated', DeprecationWarning)): + # fill wstr internal field + abc = text.encode('unicode_internal') + self.assertEqual(abc.decode('unicode_internal'), text) + + # resize text: wstr field must be cleared and then recomputed + text += 'c' + abcdef = text.encode('unicode_internal') + self.assertNotEqual(abc, abcdef) + self.assertEqual(abcdef.decode('unicode_internal'), text) class StringModuleTest(unittest.TestCase): |