22import math
33import string
44import sys
5+ import warnings
56from test import support
67from test .support import import_helper
78from test .support import warnings_helper
@@ -999,6 +1000,9 @@ def test_u(self):
9991000 self .assertRaises (TypeError , getargs_u , memoryview (b'memoryview' ))
10001001 with self .assertWarns (DeprecationWarning ):
10011002 self .assertRaises (TypeError , getargs_u , None )
1003+ with warnings .catch_warnings ():
1004+ warnings .simplefilter ('error' , DeprecationWarning )
1005+ self .assertRaises (DeprecationWarning , getargs_u , 'abc\xe9 ' )
10021006
10031007 @support .requires_legacy_unicode_capi
10041008 def test_u_hash (self ):
@@ -1015,6 +1019,9 @@ def test_u_hash(self):
10151019 self .assertRaises (TypeError , getargs_u_hash , memoryview (b'memoryview' ))
10161020 with self .assertWarns (DeprecationWarning ):
10171021 self .assertRaises (TypeError , getargs_u_hash , None )
1022+ with warnings .catch_warnings ():
1023+ warnings .simplefilter ('error' , DeprecationWarning )
1024+ self .assertRaises (DeprecationWarning , getargs_u_hash , 'abc\xe9 ' )
10181025
10191026 @support .requires_legacy_unicode_capi
10201027 def test_Z (self ):
@@ -1031,6 +1038,9 @@ def test_Z(self):
10311038 self .assertRaises (TypeError , getargs_Z , memoryview (b'memoryview' ))
10321039 with self .assertWarns (DeprecationWarning ):
10331040 self .assertIsNone (getargs_Z (None ))
1041+ with warnings .catch_warnings ():
1042+ warnings .simplefilter ('error' , DeprecationWarning )
1043+ self .assertRaises (DeprecationWarning , getargs_Z , 'abc\xe9 ' )
10341044
10351045 @support .requires_legacy_unicode_capi
10361046 def test_Z_hash (self ):
@@ -1047,6 +1057,9 @@ def test_Z_hash(self):
10471057 self .assertRaises (TypeError , getargs_Z_hash , memoryview (b'memoryview' ))
10481058 with self .assertWarns (DeprecationWarning ):
10491059 self .assertIsNone (getargs_Z_hash (None ))
1060+ with warnings .catch_warnings ():
1061+ warnings .simplefilter ('error' , DeprecationWarning )
1062+ self .assertRaises (DeprecationWarning , getargs_Z_hash , 'abc\xe9 ' )
10501063
10511064
10521065class Object_TestCase (unittest .TestCase ):
0 commit comments