11# pylint: disable=missing-docstring, no-member, no-self-use, bad-super-call
2- # pylint: disable=too-few-public-methods, unused-argument,invalid-name,too-many-public-methods
2+ # pylint: disable=too-few-public-methods, unused-argument, invalid-name, too-many-public-methods
3+ # pylint: disable=line-too-long
34
4- def not_a_method ():
5- return super (None , None ).not_a_method ()
65
6+ def not_a_method (param , param2 ):
7+ return super (None , None ).not_a_method (param , param2 )
78
8- class Base (object ):
9+
10+ class SuperBase (object ):
11+ def with_default_arg (self , first , default_arg = "only_in_super_base" ):
12+ pass
13+
14+ def with_default_arg_bis (self , first , default_arg = "only_in_super_base" ):
15+ pass
16+
17+ def with_default_arg_ter (self , first , default_arg = "will_be_changed" ):
18+ pass
19+
20+ def with_default_arg_quad (self , first , default_arg = "will_be_changed" ):
21+ pass
22+
23+
24+ class Base (SuperBase ):
25+
26+ fake_method = not_a_method
927
1028 def something (self ):
1129 pass
1230
31+ def with_default_argument (self , first , default_arg = "default" ):
32+ pass
33+
34+ def with_default_argument_bis (self , first , default_arg = "default" ):
35+ pass
36+
37+ def without_default_argument (self , first , second ):
38+ pass
39+
40+ def with_default_argument_none (self , first , default_arg = None ):
41+ pass
42+
43+ def without_default_argument2 (self , first , second ):
44+ pass
45+
46+ def with_default_argument_int (self , first , default_arg = 42 ):
47+ pass
48+
49+ def with_default_argument_tuple (self , first , default_arg = ()):
50+ pass
51+
52+ def with_default_arg_ter (self , first , default_arg = "has_been_changed" ):
53+ super (Base , self ).with_default_arg_ter (first , default_arg )
54+
55+ def with_default_arg_quad (self , first , default_arg = "has_been_changed" ):
56+ super (Base , self ).with_default_arg_quad (first , default_arg )
1357
1458class NotUselessSuper (Base ):
1559
@@ -92,6 +136,55 @@ def extraneous_positional_args(self, **args):
92136 super (NotUselessSuper , self ).extraneous_positional_args (
93137 1 , 2 , ** args )
94138
139+ def with_default_argument (self , first , default_arg = "other" ):
140+ # Not useless because the default_arg is different from the one in the base class
141+ super (NotUselessSuper , self ).with_default_argument (first , default_arg )
142+
143+ def without_default_argument (self , first , second = True ):
144+ # Not useless because in the base class there is not default value for second argument
145+ super (NotUselessSuper , self ).without_default_argument (first , second )
146+
147+ def with_default_argument_none (self , first , default_arg = 'NotNone' ):
148+ # Not useless because the default_arg is different from the one in the base class
149+ super (NotUselessSuper , self ).with_default_argument_none (first , default_arg )
150+
151+ def without_default_argument2 (self , first , second = None ):
152+ # Not useless because in the base class there is not default value for second argument
153+ super (NotUselessSuper , self ).without_default_argument2 (first , second )
154+
155+ def with_default_argument_int (self , first , default_arg = "42" ):
156+ # Not useless because the default_arg is a string whereas in the base class it's an int
157+ super (NotUselessSuper , self ).with_default_argument_int (first , default_arg )
158+
159+ def with_default_argument_tuple (self , first , default_arg = ("42" , "a" )):
160+ # Not useless because the default_arg is different from the one in the base class
161+ super (NotUselessSuper , self ).with_default_argument_tuple (first , default_arg )
162+
163+ def with_default_argument_bis (self , first , default_arg = "default" ):
164+ # Although the default_arg is the same as in the base class, the call signature
165+ # differs. Thus it is not useless.
166+ super (NotUselessSuper , self ).with_default_argument_bis (default_arg + "_argument" )
167+
168+ def fake_method (self , param2 = "other" ):
169+ super (NotUselessSuper , self ).fake_method (param2 )
170+
171+ def with_default_arg (self , first , default_arg = "only_in_super_base" ):
172+ # Not useless because the call of this method is different from the function signature
173+ super (NotUselessSuper , self ).with_default_arg (first , default_arg + "_and_here" )
174+
175+ def with_default_arg_bis (self , first , default_arg = "default_changed" ):
176+ # Not useless because the default value is different from the SuperBase one
177+ super (NotUselessSuper , self ).with_default_arg_bis (first , default_arg )
178+
179+ def with_default_arg_ter (self , first , default_arg = "has_been_changed_again" ):
180+ # Not useless because the default value is different from the Base one
181+ super (NotUselessSuper , self ).with_default_arg_ter (first , default_arg )
182+
183+ def with_default_arg_quad (self , first , default_arg = "has_been_changed" ):
184+ # Not useless because the default value is the same as in the base but the
185+ # call is different from the signature
186+ super (NotUselessSuper , self ).with_default_arg_quad (first , default_arg + "_and_modified" )
187+
95188
96189class UselessSuper (Base ):
97190
@@ -116,9 +209,38 @@ def equivalent_params_5(self, first, *args): # [useless-super-delegation]
116209 def equivalent_params_6 (self , first , * args , ** kwargs ): # [useless-super-delegation]
117210 return super (UselessSuper , self ).equivalent_params_6 (first , * args , ** kwargs )
118211
212+ def with_default_argument (self , first , default_arg = "default" ): # [useless-super-delegation]
213+ # useless because the default value here is the same as in the base class
214+ return super (UselessSuper , self ).with_default_argument (first , default_arg )
215+
216+ def without_default_argument (self , first , second ): # [useless-super-delegation]
217+ return super (UselessSuper , self ).without_default_argument (first , second )
218+
219+ def with_default_argument_none (self , first , default_arg = None ): # [useless-super-delegation]
220+ # useless because the default value here is the same as in the base class
221+ super (UselessSuper , self ).with_default_argument_none (first , default_arg )
222+
223+ def with_default_argument_int (self , first , default_arg = 42 ): # [useless-super-delegation]
224+ super (UselessSuper , self ).with_default_argument_int (first , default_arg )
225+
226+ def with_default_argument_tuple (self , first , default_arg = ()): # [useless-super-delegation]
227+ super (UselessSuper , self ).with_default_argument_tuple (first , default_arg )
228+
119229 def __init__ (self ): # [useless-super-delegation]
120230 super (UselessSuper , self ).__init__ ()
121231
232+ def with_default_arg (self , first , default_arg = "only_in_super_base" ): # [useless-super-delegation]
233+ super (UselessSuper , self ).with_default_arg (first , default_arg )
234+
235+ def with_default_arg_bis (self , first , default_arg = "only_in_super_base" ): # [useless-super-delegation]
236+ super (UselessSuper , self ).with_default_arg_bis (first , default_arg )
237+
238+ def with_default_arg_ter (self , first , default_arg = "has_been_changed" ): # [useless-super-delegation]
239+ super (UselessSuper , self ).with_default_arg_ter (first , default_arg )
240+
241+ def with_default_arg_quad (self , first , default_arg = "has_been_changed" ): # [useless-super-delegation]
242+ super (UselessSuper , self ).with_default_arg_quad (first , default_arg )
243+
122244
123245def trigger_something (value_to_trigger ):
124246 pass
0 commit comments