aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/n/no/no_classmethod_decorator.py
blob: 66cc0b3c0a20dfb259a14e8af2b1d9c339db9ab4 (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
"""Checks class methods are declared with a decorator if within the class
scope and if classmethod's argument is a member of the class
"""

# pylint: disable=too-few-public-methods, using-constant-test, no-self-argument, useless-object-inheritance

class MyClass(object):
    """Some class"""
    def __init__(self):
        pass

    def cmethod(cls):
        """class method-to-be"""
    cmethod = classmethod(cmethod)  # [no-classmethod-decorator]

    if True:
        cmethod = classmethod(cmethod)  # [no-classmethod-decorator]

    @classmethod
    def my_second_method(cls):
        """correct class method definition"""

    def other_method(cls):
        """some method"""
    cmethod2 = classmethod(other_method)  # [no-classmethod-decorator]

def helloworld():
    """says hello"""


MyClass.new_class_method = classmethod(helloworld)

class MyOtherClass(object):
    """Some other class"""
    _make = classmethod(tuple.__new__)