diff options
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-x | Lib/test/test_array.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index a94d04f..f6bf9e6 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -13,11 +13,14 @@ import pickle import operator import struct import sys +import warnings import array from array import _array_reconstructor as array_reconstructor -sizeof_wchar = array.array('u').itemsize +with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + sizeof_wchar = array.array('u').itemsize class ArraySubclass(array.array): @@ -93,8 +96,16 @@ UTF16_BE = 19 UTF32_LE = 20 UTF32_BE = 21 + class ArrayReconstructorTest(unittest.TestCase): + def setUp(self): + warnings.filterwarnings( + "ignore", + message="The 'u' type code is deprecated and " + "will be removed in Python 3.16", + category=DeprecationWarning) + def test_error(self): self.assertRaises(TypeError, array_reconstructor, "", "b", 0, b"") @@ -1208,10 +1219,16 @@ class UnicodeTest(StringTest, unittest.TestCase): self.assertRaises(ValueError, a.tounicode) self.assertRaises(ValueError, str, a) + def test_typecode_u_deprecation(self): + with self.assertWarns(DeprecationWarning): + array.array("u") + + class UCS4Test(UnicodeTest): typecode = 'w' minitemsize = 4 + class NumberTest(BaseTest): def test_extslice(self): |