summaryrefslogtreecommitdiff
path: root/pylint/test/functional/no_classmethod_decorator.py
blob: 205594dacdd37b01c16d09f5353f08eb9cfb7930 (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
"""Checks classes methods are declared with a decorator if whithin the class
scope and if classmethod's argument is a member of the class
"""

# pylint: disable=too-few-public-methods

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

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

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

def helloworld():
    """says hello"""
    print 'hello world'

MyClass.new_class_method = classmethod(helloworld)

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