Skip to content

Commit 13743cd

Browse files
authored
Resolve some docstring-first-line-empty in functional tests (#10340)
1 parent 70559b8 commit 13743cd

7 files changed

+61
-68
lines changed

pylint/checkers/refactoring/implicit_booleaness_checker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ def _get_suggestion(
342342
return f"not {name}"
343343

344344
def _in_boolean_context(self, node: nodes.Compare) -> bool:
345-
"""
346-
Returns True if the comparison is used in a boolean context; False otherwise.
345+
"""Returns True if the comparison is used in a boolean context; False otherwise.
347346
348347
A comparison is considered to be in a boolean context when it appears in constructs
349348
that evaluate its truthiness directly, such as:

tests/functional/u/use/use_implicit_booleaness_not_comparison.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ def test_func():
244244

245245

246246
def test_in_boolean_context():
247-
"""
248-
Cases where a comparison like `x != []` is used in a boolean context.
247+
"""Cases where a comparison like `x != []` is used in a boolean context.
249248
250249
It is safe and idiomatic to simplify `x != []` to just `x`.
251250
"""
@@ -290,8 +289,7 @@ def test_in_boolean_context():
290289

291290

292291
def test_not_in_boolean_context():
293-
"""
294-
Cases where a comparison like `x != []` is used in a non-boolean context.
292+
"""Cases where a comparison like `x != []` is used in a non-boolean context.
295293
296294
These comparisons cannot be safely replaced with just `x`, and should be explicitly cast using `bool(x)`.
297295
"""

tests/functional/u/use/use_implicit_booleaness_not_comparison.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,25 @@ use-implicit-booleaness-not-comparison:191:3:191:13::"""data != {}"" can be simp
3030
use-implicit-booleaness-not-comparison:199:3:199:26::"""long_test == {}"" can be simplified to ""not long_test"", if it is strictly a sequence, as an empty dict is falsey":HIGH
3131
use-implicit-booleaness-not-comparison:237:11:237:41:test_func:"""my_class.parent_function == {}"" can be simplified to ""not my_class.parent_function"", if it is strictly a sequence, as an empty dict is falsey":HIGH
3232
use-implicit-booleaness-not-comparison:238:11:238:37:test_func:"""my_class.my_property == {}"" can be simplified to ""not my_class.my_property"", if it is strictly a sequence, as an empty dict is falsey":HIGH
33-
use-implicit-booleaness-not-comparison:255:7:255:23:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
34-
use-implicit-booleaness-not-comparison:257:10:257:26:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
35-
use-implicit-booleaness-not-comparison:259:11:259:27:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
36-
use-implicit-booleaness-not-comparison:262:13:262:29:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
37-
use-implicit-booleaness-not-comparison:265:12:265:28:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
33+
use-implicit-booleaness-not-comparison:254:7:254:23:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
34+
use-implicit-booleaness-not-comparison:256:10:256:26:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
35+
use-implicit-booleaness-not-comparison:258:11:258:27:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
36+
use-implicit-booleaness-not-comparison:261:13:261:29:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
37+
use-implicit-booleaness-not-comparison:264:12:264:28:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
38+
use-implicit-booleaness-not-comparison:268:22:268:38:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
3839
use-implicit-booleaness-not-comparison:269:22:269:38:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
3940
use-implicit-booleaness-not-comparison:270:22:270:38:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
40-
use-implicit-booleaness-not-comparison:271:22:271:38:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
41+
use-implicit-booleaness-not-comparison:273:8:273:24:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
4142
use-implicit-booleaness-not-comparison:274:8:274:24:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
42-
use-implicit-booleaness-not-comparison:275:8:275:24:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
43-
use-implicit-booleaness-not-comparison:278:19:278:35:test_in_boolean_context.<lambda>:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
44-
use-implicit-booleaness-not-comparison:281:9:281:25:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
45-
use-implicit-booleaness-not-comparison:284:7:284:23:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
46-
use-implicit-booleaness-not-comparison:286:21:286:37:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
47-
use-implicit-booleaness-not-comparison:288:8:288:24:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
43+
use-implicit-booleaness-not-comparison:277:19:277:35:test_in_boolean_context.<lambda>:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
44+
use-implicit-booleaness-not-comparison:280:9:280:25:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
45+
use-implicit-booleaness-not-comparison:283:7:283:23:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
46+
use-implicit-booleaness-not-comparison:285:21:285:37:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
47+
use-implicit-booleaness-not-comparison:287:8:287:24:test_in_boolean_context:"""empty_list != []"" can be simplified to ""empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
48+
use-implicit-booleaness-not-comparison:297:8:297:24:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
4849
use-implicit-booleaness-not-comparison:299:8:299:24:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
49-
use-implicit-booleaness-not-comparison:301:8:301:24:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
50-
use-implicit-booleaness-not-comparison:303:10:303:26:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
51-
use-implicit-booleaness-not-comparison:305:5:305:21:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
52-
use-implicit-booleaness-not-comparison:307:12:307:28:test_not_in_boolean_context.<lambda>:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
53-
use-implicit-booleaness-not-comparison:309:25:309:41:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
54-
use-implicit-booleaness-not-comparison:311:11:311:27:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
50+
use-implicit-booleaness-not-comparison:301:10:301:26:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
51+
use-implicit-booleaness-not-comparison:303:5:303:21:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
52+
use-implicit-booleaness-not-comparison:305:12:305:28:test_not_in_boolean_context.<lambda>:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
53+
use-implicit-booleaness-not-comparison:307:25:307:41:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH
54+
use-implicit-booleaness-not-comparison:309:11:309:27:test_not_in_boolean_context:"""empty_list != []"" can be simplified to ""bool(empty_list)"", if it is strictly a sequence, as an empty list is falsey":HIGH

tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232

3333

3434
def test_in_boolean_context():
35-
"""
36-
Cases where a comparison like `x != ""` is used in a boolean context.
35+
"""Cases where a comparison like `x != ""` is used in a boolean context.
3736
3837
It is safe and idiomatic to simplify `x != ""` to just `x`.
3938
"""
@@ -78,8 +77,7 @@ def test_in_boolean_context():
7877

7978

8079
def test_not_in_boolean_context():
81-
"""
82-
Cases where a comparison like `x != ""` is used in a non-boolean context.
80+
"""Cases where a comparison like `x != ""` is used in a non-boolean context.
8381
8482
These comparisons cannot be safely replaced with just `x`, and should be explicitly
8583
cast using `bool(x)`.

tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ use-implicit-booleaness-not-comparison-to-string:12:3:12:10::"""X == ''"" can be
44
use-implicit-booleaness-not-comparison-to-string:15:3:15:10::"""Y != ''"" can be simplified to ""Y"", if it is strictly a string, as an empty string is falsey":HIGH
55
use-implicit-booleaness-not-comparison-to-string:18:3:18:10::"""'' == Y"" can be simplified to ""not Y"", if it is strictly a string, as an empty string is falsey":HIGH
66
use-implicit-booleaness-not-comparison-to-string:21:3:21:10::"""'' != X"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
7-
use-implicit-booleaness-not-comparison-to-string:43:7:43:14:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
8-
use-implicit-booleaness-not-comparison-to-string:45:10:45:17:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
9-
use-implicit-booleaness-not-comparison-to-string:47:11:47:18:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
10-
use-implicit-booleaness-not-comparison-to-string:50:13:50:20:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
11-
use-implicit-booleaness-not-comparison-to-string:53:12:53:19:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
7+
use-implicit-booleaness-not-comparison-to-string:42:7:42:14:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
8+
use-implicit-booleaness-not-comparison-to-string:44:10:44:17:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
9+
use-implicit-booleaness-not-comparison-to-string:46:11:46:18:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
10+
use-implicit-booleaness-not-comparison-to-string:49:13:49:20:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
11+
use-implicit-booleaness-not-comparison-to-string:52:12:52:19:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
12+
use-implicit-booleaness-not-comparison-to-string:56:22:56:29:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
1213
use-implicit-booleaness-not-comparison-to-string:57:22:57:29:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
1314
use-implicit-booleaness-not-comparison-to-string:58:22:58:29:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
14-
use-implicit-booleaness-not-comparison-to-string:59:22:59:29:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
15+
use-implicit-booleaness-not-comparison-to-string:61:8:61:15:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
1516
use-implicit-booleaness-not-comparison-to-string:62:8:62:15:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
16-
use-implicit-booleaness-not-comparison-to-string:63:8:63:15:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
17-
use-implicit-booleaness-not-comparison-to-string:66:19:66:26:test_in_boolean_context.<lambda>:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
18-
use-implicit-booleaness-not-comparison-to-string:69:9:69:16:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
19-
use-implicit-booleaness-not-comparison-to-string:72:7:72:14:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
20-
use-implicit-booleaness-not-comparison-to-string:74:21:74:28:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
21-
use-implicit-booleaness-not-comparison-to-string:76:8:76:15:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
17+
use-implicit-booleaness-not-comparison-to-string:65:19:65:26:test_in_boolean_context.<lambda>:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
18+
use-implicit-booleaness-not-comparison-to-string:68:9:68:16:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
19+
use-implicit-booleaness-not-comparison-to-string:71:7:71:14:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
20+
use-implicit-booleaness-not-comparison-to-string:73:21:73:28:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
21+
use-implicit-booleaness-not-comparison-to-string:75:8:75:15:test_in_boolean_context:"""X != ''"" can be simplified to ""X"", if it is strictly a string, as an empty string is falsey":HIGH
22+
use-implicit-booleaness-not-comparison-to-string:86:8:86:15:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
2223
use-implicit-booleaness-not-comparison-to-string:88:8:88:15:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
23-
use-implicit-booleaness-not-comparison-to-string:90:8:90:15:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
24-
use-implicit-booleaness-not-comparison-to-string:92:10:92:17:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
25-
use-implicit-booleaness-not-comparison-to-string:94:5:94:12:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
26-
use-implicit-booleaness-not-comparison-to-string:96:12:96:19:test_not_in_boolean_context.<lambda>:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
27-
use-implicit-booleaness-not-comparison-to-string:98:25:98:32:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
28-
use-implicit-booleaness-not-comparison-to-string:100:11:100:18:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
24+
use-implicit-booleaness-not-comparison-to-string:90:10:90:17:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
25+
use-implicit-booleaness-not-comparison-to-string:92:5:92:12:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
26+
use-implicit-booleaness-not-comparison-to-string:94:12:94:19:test_not_in_boolean_context.<lambda>:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
27+
use-implicit-booleaness-not-comparison-to-string:96:25:96:32:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH
28+
use-implicit-booleaness-not-comparison-to-string:98:11:98:18:test_not_in_boolean_context:"""X != ''"" can be simplified to ""bool(X)"", if it is strictly a string, as an empty string is falsey":HIGH

tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@
5656

5757

5858
def test_in_boolean_context():
59-
"""
60-
Cases where a comparison like `x != 0` is used in a boolean context.
59+
"""Cases where a comparison like `x != 0` is used in a boolean context.
6160
6261
It is safe and idiomatic to simplify `x != 0` to just `x`.
6362
"""
@@ -102,8 +101,7 @@ def test_in_boolean_context():
102101

103102

104103
def test_not_in_boolean_context():
105-
"""
106-
Cases where a comparison like `x != 0` is used in a non-boolean context.
104+
"""Cases where a comparison like `x != 0` is used in a non-boolean context.
107105
108106
These comparisons cannot be safely replaced with just `x`, and should be explicitly
109107
cast using `bool(x)`.

0 commit comments

Comments
 (0)