summaryrefslogtreecommitdiff
path: root/pylint/test/input/func_noerror_factory_method.py
blob: 9574bd33f428b773f102422ce4eeeafbe4e3541a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# pylint: disable=R0903
"""use new astroid context sensitive inference"""


class Super(object):
    """super class"""
    def __init__(self):
        self.bla = None

    def instance(cls):
        """factory method"""
        return cls()
    instance = classmethod(instance)

class Sub(Super):
    """dub class"""
    def method(self):
        """specific method"""
        return 'method called', self

# should see the Sub.instance() is returning a Sub instance, not a Super
# instance
Sub.instance().method()