@@ -16,12 +16,13 @@ def f(a, b=0, c=0, d=0):
16
16
return a + b + c + d
17
17
18
18
19
- def test_one_arguments ():
19
+ def test_one_argument ():
20
20
"""
21
21
Check whether no future warning is produced if one
22
22
positional argument given.
23
23
"""
24
- assert f (19 ) == 19
24
+ with tm .assert_produces_warning (None ):
25
+ assert f (19 ) == 19
25
26
26
27
27
28
def test_one_and_one_arguments ():
@@ -30,15 +31,17 @@ def test_one_and_one_arguments():
30
31
positional argument and one keyword argument are
31
32
given.
32
33
"""
33
- assert f (19 , d = 6 ) == 25
34
+ with tm .assert_produces_warning (None ):
35
+ assert f (19 , d = 6 ) == 25
34
36
35
37
36
38
def test_two_arguments ():
37
39
"""
38
40
Check whether no future warning is produced if two
39
41
positional arguments given.
40
42
"""
41
- assert f (1 , 5 ) == 6
43
+ with tm .assert_produces_warning (None ):
44
+ assert f (1 , 5 ) == 6
42
45
43
46
44
47
def test_two_and_two_arguments ():
@@ -47,7 +50,8 @@ def test_two_and_two_arguments():
47
50
positional arguments and two keyword arguments are
48
51
given.
49
52
"""
50
- assert f (1 , 3 , c = 3 , d = 5 ) == 12
53
+ with tm .assert_produces_warning (None ):
54
+ assert f (1 , 3 , c = 3 , d = 5 ) == 12
51
55
52
56
53
57
def test_three_arguments ():
@@ -71,10 +75,11 @@ def test_four_arguments():
71
75
@deprecate_nonkeyword_arguments (version = "1.1" )
72
76
def g (a , b = 0 , c = 0 , d = 0 ):
73
77
"""
74
- Sum of one to four numbers, the two last arguments
75
- should be given as keyword arguments only
78
+ Sum of one to four numbers, but three of them have default
79
+ values, so may be given as keyword arguments only.
76
80
"""
77
- return a + b + c + d
81
+ with tm .assert_produces_warning (None ):
82
+ return a + b + c + d
78
83
79
84
80
85
def test_one_and_three_arguments_default_allowed_args ():
@@ -85,7 +90,8 @@ def test_one_and_three_arguments_default_allowed_args():
85
90
option, meaning that all arguments with default value
86
91
are keyword-only.
87
92
"""
88
- assert g (1 , b = 3 , c = 3 , d = 5 ) == 12
93
+ with tm .assert_produces_warning (None ):
94
+ assert g (1 , b = 3 , c = 3 , d = 5 ) == 12
89
95
90
96
91
97
def test_three_arguments_default_allowed_args ():
0 commit comments