summaryrefslogtreecommitdiff
path: root/pylint/test/input/func_noerror_factory_method.py
blob: a7cff437751be1cf455988bc528665f0d65f18f7 (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, print-statement
"""use new astroid context sensitive inference"""
__revision__ = 1

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"""
        print 'method called', self

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