summaryrefslogtreecommitdiff
path: root/pylint/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/test/functional')
-rw-r--r--pylint/test/functional/access_to_protected_members.py1
-rw-r--r--pylint/test/functional/access_to_protected_members.txt6
-rw-r--r--pylint/test/functional/no_classmethod_decorator.py28
-rw-r--r--pylint/test/functional/no_classmethod_decorator.txt1
4 files changed, 33 insertions, 3 deletions
diff --git a/pylint/test/functional/access_to_protected_members.py b/pylint/test/functional/access_to_protected_members.py
index 9c92306..fd96baf 100644
--- a/pylint/test/functional/access_to_protected_members.py
+++ b/pylint/test/functional/access_to_protected_members.py
@@ -1,4 +1,5 @@
# pylint: disable=too-few-public-methods, W0231, print-statement
+# pylint: disable=no-classmethod-decorator
"""Test external access to protected class members."""
from __future__ import print_function
diff --git a/pylint/test/functional/access_to_protected_members.txt b/pylint/test/functional/access_to_protected_members.txt
index 123c1dd..7ba601b 100644
--- a/pylint/test/functional/access_to_protected_members.txt
+++ b/pylint/test/functional/access_to_protected_members.txt
@@ -1,5 +1,5 @@
-protected-access:18:MyClass.test:Access to a protected member _haha of a client class
-protected-access:40::Access to a protected member _protected of a client class
+protected-access:19:MyClass.test:Access to a protected member _haha of a client class
protected-access:41::Access to a protected member _protected of a client class
-protected-access:42::Access to a protected member _cls_protected of a client class
+protected-access:42::Access to a protected member _protected of a client class
protected-access:43::Access to a protected member _cls_protected of a client class
+protected-access:44::Access to a protected member _cls_protected of a client class
diff --git a/pylint/test/functional/no_classmethod_decorator.py b/pylint/test/functional/no_classmethod_decorator.py
new file mode 100644
index 0000000..205594d
--- /dev/null
+++ b/pylint/test/functional/no_classmethod_decorator.py
@@ -0,0 +1,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__)
diff --git a/pylint/test/functional/no_classmethod_decorator.txt b/pylint/test/functional/no_classmethod_decorator.txt
new file mode 100644
index 0000000..8c1060f
--- /dev/null
+++ b/pylint/test/functional/no_classmethod_decorator.txt
@@ -0,0 +1 @@
+no-classmethod-decorator:14:MyClass:Consider using a decorator instead of calling classmethod