@@ -34,12 +34,8 @@ def test_named_arguments(msg):
34
34
with pytest .raises (TypeError ) as excinfo :
35
35
# noinspection PyArgumentList
36
36
kw_func2 (x = 5 , y = 10 , z = 12 )
37
- assert msg (excinfo .value ) == """
38
- kw_func2(): incompatible function arguments. The following argument types are supported:
39
- 1. (x: int=100, y: int=200) -> str
40
-
41
- Invoked with:
42
- """
37
+ assert excinfo .match (
38
+ r'(?s)^kw_func2\(\): incompatible.*Invoked with: kwargs: ((x=5|y=10|z=12)(, |$)){3}$' )
43
39
44
40
assert kw_func4 () == "{13 17}"
45
41
assert kw_func4 (myList = [1 , 2 , 3 ]) == "{1 2 3}"
@@ -74,15 +70,15 @@ def test_mixed_args_and_kwargs(msg):
74
70
1. (arg0: int, arg1: float, *args) -> tuple
75
71
76
72
Invoked with: 1
77
- """ # noqa: E501
73
+ """ # noqa: E501 line too long
78
74
with pytest .raises (TypeError ) as excinfo :
79
75
assert mpa ()
80
76
assert msg (excinfo .value ) == """
81
77
mixed_plus_args(): incompatible function arguments. The following argument types are supported:
82
78
1. (arg0: int, arg1: float, *args) -> tuple
83
79
84
80
Invoked with:
85
- """ # noqa: E501
81
+ """ # noqa: E501 line too long
86
82
87
83
assert mpk (- 2 , 3.5 , pi = 3.14159 , e = 2.71828 ) == (- 2 , 3.5 , {'e' : 2.71828 , 'pi' : 3.14159 })
88
84
assert mpak (7 , 7.7 , 7.77 , 7.777 , 7.7777 , minusseven = - 7 ) == (
@@ -93,14 +89,20 @@ def test_mixed_args_and_kwargs(msg):
93
89
assert mpakd (k = 42 ) == (1 , 3.14159 , (), {'k' : 42 })
94
90
assert mpakd (1 , 1 , 2 , 3 , 5 , 8 , then = 13 , followedby = 21 ) == (
95
91
1 , 1 , (2 , 3 , 5 , 8 ), {'then' : 13 , 'followedby' : 21 })
96
- # Arguments specified both positionally and via kwargs is an error :
92
+ # Arguments specified both positionally and via kwargs should fail :
97
93
with pytest .raises (TypeError ) as excinfo :
98
94
assert mpakd (1 , i = 1 )
99
95
assert msg (excinfo .value ) == """
100
- mixed_plus_args_kwargs_defaults(): got multiple values for argument 'i'
101
- """
96
+ mixed_plus_args_kwargs_defaults(): incompatible function arguments. The following argument types are supported:
97
+ 1. (i: int=1, j: float=3.14159, *args, **kwargs) -> tuple
98
+
99
+ Invoked with: 1; kwargs: i=1
100
+ """ # noqa: E501 line too long
102
101
with pytest .raises (TypeError ) as excinfo :
103
102
assert mpakd (1 , 2 , j = 1 )
104
103
assert msg (excinfo .value ) == """
105
- mixed_plus_args_kwargs_defaults(): got multiple values for argument 'j'
106
- """
104
+ mixed_plus_args_kwargs_defaults(): incompatible function arguments. The following argument types are supported:
105
+ 1. (i: int=1, j: float=3.14159, *args, **kwargs) -> tuple
106
+
107
+ Invoked with: 1, 2; kwargs: j=1
108
+ """ # noqa: E501 line too long
0 commit comments