summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-09 22:00:12 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-28 22:45:45 +0200
commitfa6ef4db33782665c9827a6a6e0697eb16e3a8b7 (patch)
tree37daaa21c1c1b2e6243076c5d169fd398509eccd
parentd885b40ffbc6fad6e1f1798ef59e65187696ef07 (diff)
downloadpylint-git-fa6ef4db33782665c9827a6a6e0697eb16e3a8b7.tar.gz
Migrate func_first_arg.py to new functional tests
-rw-r--r--tests/functional/f/first_arg.py42
-rw-r--r--tests/functional/f/first_arg.txt9
-rw-r--r--tests/input/func_first_arg.py42
-rw-r--r--tests/messages/func_first_arg.txt9
-rw-r--r--tests/test_func.py4
5 files changed, 54 insertions, 52 deletions
diff --git a/tests/functional/f/first_arg.py b/tests/functional/f/first_arg.py
new file mode 100644
index 000000000..4391bc88b
--- /dev/null
+++ b/tests/functional/f/first_arg.py
@@ -0,0 +1,42 @@
+# pylint: disable=C0111, W0232, useless-object-inheritance
+"""check for methods first arguments
+"""
+
+__revision__ = 0
+
+
+class Obj(object):
+ # C0202, classmethod
+ def __new__(something): # [bad-classmethod-argument]
+ pass
+
+ # C0202, classmethod
+ def class1(cls):
+ pass
+ class1 = classmethod(class1) # [no-classmethod-decorator]
+
+ def class2(other): # [bad-classmethod-argument]
+ pass
+ class2 = classmethod(class2) # [no-classmethod-decorator]
+
+
+class Meta(type):
+ # C0204, metaclass __new__
+ def __new__(other, name, bases, dct): # [bad-mcs-classmethod-argument]
+ pass
+
+ # C0203, metaclass method
+ def method1(cls):
+ pass
+
+ def method2(other): # [bad-mcs-method-argument]
+ pass
+
+ # C0205, metaclass classmethod
+ def class1(cls):
+ pass
+ class1 = classmethod(class1) # [no-classmethod-decorator]
+
+ def class2(other): # [bad-mcs-classmethod-argument]
+ pass
+ class2 = classmethod(class2) # [no-classmethod-decorator]
diff --git a/tests/functional/f/first_arg.txt b/tests/functional/f/first_arg.txt
new file mode 100644
index 000000000..8344fa8dd
--- /dev/null
+++ b/tests/functional/f/first_arg.txt
@@ -0,0 +1,9 @@
+bad-classmethod-argument:10:4:Obj.__new__:Class method __new__ should have 'cls' as first argument
+no-classmethod-decorator:16:4:Obj:Consider using a decorator instead of calling classmethod
+bad-classmethod-argument:18:4:Obj.class2:Class method class2 should have 'cls' as first argument
+no-classmethod-decorator:20:4:Obj:Consider using a decorator instead of calling classmethod
+bad-mcs-classmethod-argument:25:4:Meta.__new__:Metaclass class method __new__ should have 'cls' as first argument
+bad-mcs-method-argument:32:4:Meta.method2:Metaclass method method2 should have 'cls' as first argument
+no-classmethod-decorator:38:4:Meta:Consider using a decorator instead of calling classmethod
+bad-mcs-classmethod-argument:40:4:Meta.class2:Metaclass class method class2 should have 'cls' as first argument
+no-classmethod-decorator:42:4:Meta:Consider using a decorator instead of calling classmethod
diff --git a/tests/input/func_first_arg.py b/tests/input/func_first_arg.py
deleted file mode 100644
index 7df2fd20c..000000000
--- a/tests/input/func_first_arg.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# pylint: disable=C0111, W0232, useless-object-inheritance
-"""check for methods first arguments
-"""
-
-__revision__ = 0
-
-
-class Obj(object):
- # C0202, classmethod
- def __new__(something):
- pass
-
- # C0202, classmethod
- def class1(cls):
- pass
- class1 = classmethod(class1)
-
- def class2(other):
- pass
- class2 = classmethod(class2)
-
-
-class Meta(type):
- # C0204, metaclass __new__
- def __new__(other, name, bases, dct):
- pass
-
- # C0203, metaclass method
- def method1(cls):
- pass
-
- def method2(other):
- pass
-
- # C0205, metaclass classmethod
- def class1(cls):
- pass
- class1 = classmethod(class1)
-
- def class2(other):
- pass
- class2 = classmethod(class2)
diff --git a/tests/messages/func_first_arg.txt b/tests/messages/func_first_arg.txt
deleted file mode 100644
index 8d932048a..000000000
--- a/tests/messages/func_first_arg.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-C: 10:Obj.__new__: Class method __new__ should have 'cls' as first argument
-C: 18:Obj.class2: Class method class2 should have 'cls' as first argument
-C: 25:Meta.__new__: Metaclass class method __new__ should have 'cls' as first argument
-C: 32:Meta.method2: Metaclass method method2 should have 'cls' as first argument
-C: 40:Meta.class2: Metaclass class method class2 should have 'cls' as first argument
-R: 16:Obj: Consider using a decorator instead of calling classmethod
-R: 20:Obj: Consider using a decorator instead of calling classmethod
-R: 38:Meta: Consider using a decorator instead of calling classmethod
-R: 42:Meta: Consider using a decorator instead of calling classmethod
diff --git a/tests/test_func.py b/tests/test_func.py
index 6e3a86c2b..59c467d13 100644
--- a/tests/test_func.py
+++ b/tests/test_func.py
@@ -120,7 +120,9 @@ def gen_tests(filter_rgx):
tests.append((module_file, messages_file, dependencies))
if UPDATE_FILE.exists():
return tests
- assert len(tests) < 14, "Please do not add new test cases here."
+ assert len(tests) < 13, "Please do not add new test cases here." + "\n".join(
+ str(k) for k in tests if not k[2]
+ )
return tests