diff options
Diffstat (limited to 'pylint/test/functional/no_staticmethod_decorator.py')
-rw-r--r-- | pylint/test/functional/no_staticmethod_decorator.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pylint/test/functional/no_staticmethod_decorator.py b/pylint/test/functional/no_staticmethod_decorator.py new file mode 100644 index 0000000..636b2a5 --- /dev/null +++ b/pylint/test/functional/no_staticmethod_decorator.py @@ -0,0 +1,28 @@ +"""Checks static methods are declared with a decorator if whithin the class +scope and if static method's argument is a member of the class +""" + +# pylint: disable=too-few-public-methods + +class MyClass(object): + """Some class""" + def __init__(self): + pass + + def smethod(): + """static method-to-be""" + smethod = staticmethod(smethod) # [no-staticmethod-decorator] + + @staticmethod + def my_second_method(): + """correct static method definition""" + +def helloworld(): + """says hello""" + print 'hello world' + +MyClass.new_static_method = staticmethod(helloworld) + +class MyOtherClass(object): + """Some other class""" + _make = staticmethod(tuple.__new__) |