2
2
import math
3
3
import string
4
4
import sys
5
+ import warnings
5
6
from test import support
6
7
from test .support import import_helper
7
8
from test .support import warnings_helper
@@ -999,6 +1000,9 @@ def test_u(self):
999
1000
self .assertRaises (TypeError , getargs_u , memoryview (b'memoryview' ))
1000
1001
with self .assertWarns (DeprecationWarning ):
1001
1002
self .assertRaises (TypeError , getargs_u , None )
1003
+ with warnings .catch_warnings ():
1004
+ warnings .simplefilter ('error' , DeprecationWarning )
1005
+ self .assertRaises (DeprecationWarning , getargs_u , 'abc\xe9 ' )
1002
1006
1003
1007
@support .requires_legacy_unicode_capi
1004
1008
def test_u_hash (self ):
@@ -1015,6 +1019,9 @@ def test_u_hash(self):
1015
1019
self .assertRaises (TypeError , getargs_u_hash , memoryview (b'memoryview' ))
1016
1020
with self .assertWarns (DeprecationWarning ):
1017
1021
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 ' )
1018
1025
1019
1026
@support .requires_legacy_unicode_capi
1020
1027
def test_Z (self ):
@@ -1031,6 +1038,9 @@ def test_Z(self):
1031
1038
self .assertRaises (TypeError , getargs_Z , memoryview (b'memoryview' ))
1032
1039
with self .assertWarns (DeprecationWarning ):
1033
1040
self .assertIsNone (getargs_Z (None ))
1041
+ with warnings .catch_warnings ():
1042
+ warnings .simplefilter ('error' , DeprecationWarning )
1043
+ self .assertRaises (DeprecationWarning , getargs_Z , 'abc\xe9 ' )
1034
1044
1035
1045
@support .requires_legacy_unicode_capi
1036
1046
def test_Z_hash (self ):
@@ -1047,6 +1057,9 @@ def test_Z_hash(self):
1047
1057
self .assertRaises (TypeError , getargs_Z_hash , memoryview (b'memoryview' ))
1048
1058
with self .assertWarns (DeprecationWarning ):
1049
1059
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 ' )
1050
1063
1051
1064
1052
1065
class Object_TestCase (unittest .TestCase ):
0 commit comments