summaryrefslogtreecommitdiff
path: root/test/functional/super_checks.py
blob: d9acfa3a12dfd3198c8e2209f5d85f57f91f4318 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
# pylint: disable=too-few-public-methods,import-error
"""check use of super"""

from unknown import Missing

class Aaaa:  # <3.0:[old-style-class]
    """old style"""
    def hop(self):  # <3.0:[super-on-old-class]
        """hop"""
        super(Aaaa, self).hop()

    def __init__(self):  # <3.0:[super-on-old-class]
        super(Aaaa, self).__init__()

class NewAaaa(object):
    """old style"""
    def hop(self):
        """hop"""
        super(NewAaaa, self).hop()

    def __init__(self):
        super(object, self).__init__()  # [bad-super-call]

class Py3kAaaa(NewAaaa):
    """new style"""
    def __init__(self):
        super().__init__()  # <3.0:[missing-super-argument]

class Py3kWrongSuper(Py3kAaaa):
    """new style"""
    def __init__(self):
        super(NewAaaa, self).__init__()  # [bad-super-call]

class WrongNameRegression(Py3kAaaa):
    """ test a regression with the message """
    def __init__(self):
        super(Missing, self).__init__()  # [bad-super-call]

class Getattr(object):
    """ crash """
    name = NewAaaa

class CrashSuper(object):
    """ test a crash with this checker """
    def __init__(self):
        super(Getattr.name, self).__init__()  # [bad-super-call]