aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/c/classes_meth_could_be_a_function.py
blob: 94103a32407ad7244f8aaad88673b9693aa91b6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# pylint: disable=missing-docstring,too-few-public-methods,no-init,useless-object-inheritance
"""
#2479

R0201 (formely W0212), Method could be a function shouldn't be emitted in case
like factory method pattern
"""
__revision__ = 1

class XAsub(object):
    pass
class XBsub(XAsub):
    pass
class XCsub(XAsub):
    pass

class Aimpl(object):
    # disable "method could be a function" on classes which are not overriding
    # the factory method because in that case the usage of polymorphism is not
    # detected
    # pylint: disable=no-self-use
    def makex(self):
        return XAsub()

class Bimpl(Aimpl):

    def makex(self):
        return XBsub()

class Cimpl(Aimpl):

    def makex(self):
        return XCsub()