@@ -2891,7 +2891,9 @@ def test():
28912891 self .call (test , 1 )
28922892 with self .assertRaisesRegex (TypeError , 'too many positional arguments' ):
28932893 self .call (test , 1 , spam = 10 )
2894- with self .assertRaisesRegex (TypeError , 'too many keyword arguments' ):
2894+ with self .assertRaisesRegex (
2895+ TypeError , "got an unexpected keyword argument 'spam'" ):
2896+
28952897 self .call (test , spam = 1 )
28962898
28972899 def test_signature_bind_var (self ):
@@ -2916,10 +2918,12 @@ def test(a, b, c):
29162918 with self .assertRaisesRegex (TypeError , 'too many positional arguments' ):
29172919 self .call (test , 1 , 2 , 3 , 4 )
29182920
2919- with self .assertRaisesRegex (TypeError , "'b' parameter lacking default" ):
2921+ with self .assertRaisesRegex (TypeError ,
2922+ "missing a required argument: 'b'" ):
29202923 self .call (test , 1 )
29212924
2922- with self .assertRaisesRegex (TypeError , "'a' parameter lacking default" ):
2925+ with self .assertRaisesRegex (TypeError ,
2926+ "missing a required argument: 'a'" ):
29232927 self .call (test )
29242928
29252929 def test (a , b , c = 10 ):
@@ -2992,16 +2996,17 @@ def test(*, foo):
29922996 def test (a , * , foo = 1 , bar ):
29932997 return foo
29942998 with self .assertRaisesRegex (TypeError ,
2995- "'bar' parameter lacking default value " ):
2999+ "missing a required argument: 'bar' " ):
29963000 self .call (test , 1 )
29973001
29983002 def test (foo , * , bar ):
29993003 return foo , bar
30003004 self .assertEqual (self .call (test , 1 , bar = 2 ), (1 , 2 ))
30013005 self .assertEqual (self .call (test , bar = 2 , foo = 1 ), (1 , 2 ))
30023006
3003- with self .assertRaisesRegex (TypeError ,
3004- 'too many keyword arguments' ):
3007+ with self .assertRaisesRegex (
3008+ TypeError , "got an unexpected keyword argument 'spam'" ):
3009+
30053010 self .call (test , bar = 2 , foo = 1 , spam = 10 )
30063011
30073012 with self .assertRaisesRegex (TypeError ,
@@ -3012,12 +3017,13 @@ def test(foo, *, bar):
30123017 'too many positional arguments' ):
30133018 self .call (test , 1 , 2 , bar = 2 )
30143019
3015- with self .assertRaisesRegex (TypeError ,
3016- 'too many keyword arguments' ):
3020+ with self .assertRaisesRegex (
3021+ TypeError , "got an unexpected keyword argument 'spam'" ):
3022+
30173023 self .call (test , 1 , bar = 2 , spam = 'ham' )
30183024
30193025 with self .assertRaisesRegex (TypeError ,
3020- "'bar' parameter lacking default value " ):
3026+ "missing a required argument: 'bar' " ):
30213027 self .call (test , 1 )
30223028
30233029 def test (foo , * , bar , ** bin ):
@@ -3029,7 +3035,7 @@ def test(foo, *, bar, **bin):
30293035 self .assertEqual (self .call (test , spam = 'ham' , foo = 1 , bar = 2 ),
30303036 (1 , 2 , {'spam' : 'ham' }))
30313037 with self .assertRaisesRegex (TypeError ,
3032- "'foo' parameter lacking default value " ):
3038+ "missing a required argument: 'foo' " ):
30333039 self .call (test , spam = 'ham' , bar = 2 )
30343040 self .assertEqual (self .call (test , 1 , bar = 2 , bin = 1 , spam = 10 ),
30353041 (1 , 2 , {'bin' : 1 , 'spam' : 10 }))
@@ -3094,7 +3100,9 @@ def test(a, *args):
30943100 return a , args
30953101 sig = inspect .signature (test )
30963102
3097- with self .assertRaisesRegex (TypeError , "too many keyword arguments" ):
3103+ with self .assertRaisesRegex (
3104+ TypeError , "got an unexpected keyword argument 'args'" ):
3105+
30983106 sig .bind (a = 0 , args = 1 )
30993107
31003108 def test (* args , ** kwargs ):
0 commit comments