Skip to content

Commit 29e74e4

Browse files
authored
Add a functional test for the useless-parent-delegation checker. (#7326)
Closes #7287
1 parent 2fafadc commit 29e74e4

File tree

2 files changed

+37
-25
lines changed

2 files changed

+37
-25
lines changed

tests/functional/u/useless/useless_parent_delegation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# pylint: disable=too-few-public-methods, unused-argument, invalid-name, too-many-public-methods
33
# pylint: disable=line-too-long, arguments-out-of-order
44
# pylint: disable=super-with-arguments, dangerous-default-value
5+
# pylint: disable=too-many-function-args, no-method-argument
56

67
import random
78
from typing import Any, List
@@ -413,3 +414,14 @@ class ReturnTypeSame(ReturnTypeAny):
413414

414415
def draw(self) -> Any: # [useless-parent-delegation]
415416
return super().draw()
417+
418+
419+
# Any number of positional arguments followed by one keyword argument with a default value
420+
class Fruit:
421+
def __init__(*, tastes_bitter=None):
422+
...
423+
424+
425+
class Lemon(Fruit):
426+
def __init__(*, tastes_bitter=True):
427+
super().__init__(tastes_bitter=tastes_bitter)
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
useless-parent-delegation:220:4:220:25:UselessSuper.equivalent_params:Useless parent or super() delegation in method 'equivalent_params':INFERENCE
2-
useless-parent-delegation:223:4:223:27:UselessSuper.equivalent_params_1:Useless parent or super() delegation in method 'equivalent_params_1':INFERENCE
3-
useless-parent-delegation:226:4:226:27:UselessSuper.equivalent_params_2:Useless parent or super() delegation in method 'equivalent_params_2':INFERENCE
4-
useless-parent-delegation:229:4:229:27:UselessSuper.equivalent_params_3:Useless parent or super() delegation in method 'equivalent_params_3':INFERENCE
5-
useless-parent-delegation:232:4:232:27:UselessSuper.equivalent_params_4:Useless parent or super() delegation in method 'equivalent_params_4':INFERENCE
6-
useless-parent-delegation:235:4:235:27:UselessSuper.equivalent_params_5:Useless parent or super() delegation in method 'equivalent_params_5':INFERENCE
7-
useless-parent-delegation:238:4:238:27:UselessSuper.equivalent_params_6:Useless parent or super() delegation in method 'equivalent_params_6':INFERENCE
8-
useless-parent-delegation:241:4:241:29:UselessSuper.with_default_argument:Useless parent or super() delegation in method 'with_default_argument':INFERENCE
9-
useless-parent-delegation:245:4:245:32:UselessSuper.without_default_argument:Useless parent or super() delegation in method 'without_default_argument':INFERENCE
10-
useless-parent-delegation:248:4:248:34:UselessSuper.with_default_argument_none:Useless parent or super() delegation in method 'with_default_argument_none':INFERENCE
11-
useless-parent-delegation:252:4:252:33:UselessSuper.with_default_argument_int:Useless parent or super() delegation in method 'with_default_argument_int':INFERENCE
12-
useless-parent-delegation:255:4:255:35:UselessSuper.with_default_argument_tuple:Useless parent or super() delegation in method 'with_default_argument_tuple':INFERENCE
13-
useless-parent-delegation:258:4:258:34:UselessSuper.with_default_argument_dict:Useless parent or super() delegation in method 'with_default_argument_dict':INFERENCE
14-
useless-parent-delegation:261:4:261:33:UselessSuper.with_default_argument_var:Useless parent or super() delegation in method 'with_default_argument_var':INFERENCE
15-
useless-parent-delegation:264:4:264:16:UselessSuper.__init__:Useless parent or super() delegation in method '__init__':INFERENCE
16-
useless-parent-delegation:267:4:267:24:UselessSuper.with_default_arg:Useless parent or super() delegation in method 'with_default_arg':INFERENCE
17-
useless-parent-delegation:270:4:270:28:UselessSuper.with_default_arg_bis:Useless parent or super() delegation in method 'with_default_arg_bis':INFERENCE
18-
useless-parent-delegation:273:4:273:28:UselessSuper.with_default_arg_ter:Useless parent or super() delegation in method 'with_default_arg_ter':INFERENCE
19-
useless-parent-delegation:276:4:276:29:UselessSuper.with_default_arg_quad:Useless parent or super() delegation in method 'with_default_arg_quad':INFERENCE
20-
useless-parent-delegation:310:4:310:16:DecoratedList.__hash__:Useless parent or super() delegation in method '__hash__':INFERENCE
21-
useless-parent-delegation:336:4:336:16:SubTwoOne.__init__:Useless parent or super() delegation in method '__init__':INFERENCE
22-
useless-parent-delegation:359:4:359:15:UselessSuperPy3.useless:Useless parent or super() delegation in method 'useless':INFERENCE
23-
useless-parent-delegation:374:4:374:16:Ham.__init__:Useless parent or super() delegation in method '__init__':INFERENCE
24-
useless-parent-delegation:407:4:407:12:ReturnTypeSpecified.draw:Useless parent or super() delegation in method 'draw':INFERENCE
25-
useless-parent-delegation:414:4:414:12:ReturnTypeSame.draw:Useless parent or super() delegation in method 'draw':INFERENCE
1+
useless-parent-delegation:221:4:221:25:UselessSuper.equivalent_params:Useless parent or super() delegation in method 'equivalent_params':INFERENCE
2+
useless-parent-delegation:224:4:224:27:UselessSuper.equivalent_params_1:Useless parent or super() delegation in method 'equivalent_params_1':INFERENCE
3+
useless-parent-delegation:227:4:227:27:UselessSuper.equivalent_params_2:Useless parent or super() delegation in method 'equivalent_params_2':INFERENCE
4+
useless-parent-delegation:230:4:230:27:UselessSuper.equivalent_params_3:Useless parent or super() delegation in method 'equivalent_params_3':INFERENCE
5+
useless-parent-delegation:233:4:233:27:UselessSuper.equivalent_params_4:Useless parent or super() delegation in method 'equivalent_params_4':INFERENCE
6+
useless-parent-delegation:236:4:236:27:UselessSuper.equivalent_params_5:Useless parent or super() delegation in method 'equivalent_params_5':INFERENCE
7+
useless-parent-delegation:239:4:239:27:UselessSuper.equivalent_params_6:Useless parent or super() delegation in method 'equivalent_params_6':INFERENCE
8+
useless-parent-delegation:242:4:242:29:UselessSuper.with_default_argument:Useless parent or super() delegation in method 'with_default_argument':INFERENCE
9+
useless-parent-delegation:246:4:246:32:UselessSuper.without_default_argument:Useless parent or super() delegation in method 'without_default_argument':INFERENCE
10+
useless-parent-delegation:249:4:249:34:UselessSuper.with_default_argument_none:Useless parent or super() delegation in method 'with_default_argument_none':INFERENCE
11+
useless-parent-delegation:253:4:253:33:UselessSuper.with_default_argument_int:Useless parent or super() delegation in method 'with_default_argument_int':INFERENCE
12+
useless-parent-delegation:256:4:256:35:UselessSuper.with_default_argument_tuple:Useless parent or super() delegation in method 'with_default_argument_tuple':INFERENCE
13+
useless-parent-delegation:259:4:259:34:UselessSuper.with_default_argument_dict:Useless parent or super() delegation in method 'with_default_argument_dict':INFERENCE
14+
useless-parent-delegation:262:4:262:33:UselessSuper.with_default_argument_var:Useless parent or super() delegation in method 'with_default_argument_var':INFERENCE
15+
useless-parent-delegation:265:4:265:16:UselessSuper.__init__:Useless parent or super() delegation in method '__init__':INFERENCE
16+
useless-parent-delegation:268:4:268:24:UselessSuper.with_default_arg:Useless parent or super() delegation in method 'with_default_arg':INFERENCE
17+
useless-parent-delegation:271:4:271:28:UselessSuper.with_default_arg_bis:Useless parent or super() delegation in method 'with_default_arg_bis':INFERENCE
18+
useless-parent-delegation:274:4:274:28:UselessSuper.with_default_arg_ter:Useless parent or super() delegation in method 'with_default_arg_ter':INFERENCE
19+
useless-parent-delegation:277:4:277:29:UselessSuper.with_default_arg_quad:Useless parent or super() delegation in method 'with_default_arg_quad':INFERENCE
20+
useless-parent-delegation:311:4:311:16:DecoratedList.__hash__:Useless parent or super() delegation in method '__hash__':INFERENCE
21+
useless-parent-delegation:337:4:337:16:SubTwoOne.__init__:Useless parent or super() delegation in method '__init__':INFERENCE
22+
useless-parent-delegation:360:4:360:15:UselessSuperPy3.useless:Useless parent or super() delegation in method 'useless':INFERENCE
23+
useless-parent-delegation:375:4:375:16:Ham.__init__:Useless parent or super() delegation in method '__init__':INFERENCE
24+
useless-parent-delegation:408:4:408:12:ReturnTypeSpecified.draw:Useless parent or super() delegation in method 'draw':INFERENCE
25+
useless-parent-delegation:415:4:415:12:ReturnTypeSame.draw:Useless parent or super() delegation in method 'draw':INFERENCE

0 commit comments

Comments
 (0)