diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-09 22:00:12 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-14 19:48:30 +0100 |
commit | bac894e11a423cca091a03ae01e2b08e9988dec7 (patch) | |
tree | b8868e6bc71b1cdf88a851ebb604c2e9fbd8173b /tests/functional/f | |
parent | aff0699503421c123d72245abf7440fc96dd01f2 (diff) | |
download | pylint-git-bac894e11a423cca091a03ae01e2b08e9988dec7.tar.gz |
Migrate func_first_arg.py to new functional tests
Diffstat (limited to 'tests/functional/f')
-rw-r--r-- | tests/functional/f/first_arg.py | 42 | ||||
-rw-r--r-- | tests/functional/f/first_arg.txt | 9 |
2 files changed, 51 insertions, 0 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 |