summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-09 21:15:36 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-14 19:48:30 +0100
commitac13b1f094d532d91d54bd92c578c728bf0bc58e (patch)
tree6226a0a35ee0f50baa7e2c4a67f0faa268bb5cde
parent2311398f99759aa22b225d3f5bc4a901ceba50c3 (diff)
downloadpylint-git-ac13b1f094d532d91d54bd92c578c728bf0bc58e.tar.gz
Migrate func_w0613.py to new functional tests
-rw-r--r--tests/functional/u/unused/unused_argument.py43
-rw-r--r--tests/functional/u/unused/unused_argument.txt5
-rw-r--r--tests/input/func_w0613.py42
-rw-r--r--tests/messages/func_w0613.txt5
-rw-r--r--tests/test_func.py2
5 files changed, 48 insertions, 49 deletions
diff --git a/tests/functional/u/unused/unused_argument.py b/tests/functional/u/unused/unused_argument.py
index 013d4b3e5..f0b435f70 100644
--- a/tests/functional/u/unused/unused_argument.py
+++ b/tests/functional/u/unused/unused_argument.py
@@ -29,7 +29,7 @@ class Sub(Base):
"overridden method, though don't use every argument"
return aaa
- def newmethod(self, aax, aay): # [unused-argument]
+ def newmethod(self, aax, aay): # [unused-argument]
"another method, warning for aay desired"
return self, aax
@@ -46,3 +46,44 @@ def metadata_from_dict(key):
used inside comprehension dict
"""
return {key: str(value) for key, value in key.items()}
+
+# pylint: disable=R0903, print-statement, misplaced-future,wrong-import-position
+from __future__ import print_function
+
+
+def function(arg=1): # [unused-argument]
+ """ignore arg"""
+
+
+class AAAA(object):
+ """dummy class"""
+
+ def method(self, arg): # [unused-argument]
+ """dummy method"""
+ print(self)
+ def __init__(self, *unused_args, **unused_kwargs):
+ pass
+
+ @classmethod
+ def selected(cls, *args, **kwargs): # [unused-argument, unused-argument]
+ """called by the registry when the vobject has been selected.
+ """
+ return cls
+
+ def using_inner_function(self, etype, size=1):
+ """return a fake result set for a particular entity type"""
+ rset = AAAA([('A',)]*size, '%s X' % etype,
+ description=[(etype,)]*size)
+ def inner(row, col=0, etype=etype, req=self, rset=rset):
+ """inner using all its argument"""
+ # pylint: disable = E1103
+ return req.vreg.etype_class(etype)(req, rset, row, col)
+ # pylint: disable = W0201
+ rset.get_entity = inner
+
+class BBBB(object):
+ """dummy class"""
+
+ def __init__(self, arg): # [unused-argument]
+ """Constructor with an extra parameter. Should raise a warning"""
+ self.spam = 1
diff --git a/tests/functional/u/unused/unused_argument.txt b/tests/functional/u/unused/unused_argument.txt
index a30ff2259..b1ad4ad5a 100644
--- a/tests/functional/u/unused/unused_argument.txt
+++ b/tests/functional/u/unused/unused_argument.txt
@@ -1,3 +1,8 @@
unused-argument:3:16:test_unused:Unused argument 'first'
unused-argument:3:23:test_unused:Unused argument 'second'
unused-argument:32:29:Sub.newmethod:Unused argument 'aay':INFERENCE
+unused-argument:54:13:function:Unused argument 'arg'
+unused-argument:61:21:AAAA.method:Unused argument 'arg':INFERENCE
+unused-argument:68:0:AAAA.selected:Unused argument 'args':INFERENCE
+unused-argument:68:0:AAAA.selected:Unused argument 'kwargs':INFERENCE
+unused-argument:87:23:BBBB.__init__:Unused argument 'arg':INFERENCE
diff --git a/tests/input/func_w0613.py b/tests/input/func_w0613.py
deleted file mode 100644
index 02213c83b..000000000
--- a/tests/input/func_w0613.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# pylint: disable=R0903, print-statement, useless-object-inheritance
-"""test unused argument
-"""
-from __future__ import print_function
-
-
-def function(arg=1):
- """ignore arg"""
-
-
-class AAAA(object):
- """dummy class"""
-
- def method(self, arg):
- """dummy method"""
- print(self)
- def __init__(self, *unused_args, **unused_kwargs):
- pass
-
- @classmethod
- def selected(cls, *args, **kwargs):
- """called by the registry when the vobject has been selected.
- """
- return cls
-
- def using_inner_function(self, etype, size=1):
- """return a fake result set for a particular entity type"""
- rset = AAAA([('A',)]*size, '%s X' % etype,
- description=[(etype,)]*size)
- def inner(row, col=0, etype=etype, req=self, rset=rset):
- """inner using all its argument"""
- # pylint: disable = E1103
- return req.vreg.etype_class(etype)(req, rset, row, col)
- # pylint: disable = W0201
- rset.get_entity = inner
-
-class BBBB(object):
- """dummy class"""
-
- def __init__(self, arg):
- """Constructor with an extra parameter. Should raise a warning"""
- self.spam = 1
diff --git a/tests/messages/func_w0613.txt b/tests/messages/func_w0613.txt
deleted file mode 100644
index 36cb38014..000000000
--- a/tests/messages/func_w0613.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-W: 7:function: Unused argument 'arg'
-W: 14:AAAA.method: Unused argument 'arg'
-W: 21:AAAA.selected: Unused argument 'args'
-W: 21:AAAA.selected: Unused argument 'kwargs'
-W: 40:BBBB.__init__: Unused argument 'arg'
diff --git a/tests/test_func.py b/tests/test_func.py
index 24c8ae6b2..6e3a86c2b 100644
--- a/tests/test_func.py
+++ b/tests/test_func.py
@@ -120,7 +120,7 @@ def gen_tests(filter_rgx):
tests.append((module_file, messages_file, dependencies))
if UPDATE_FILE.exists():
return tests
- assert len(tests) < 15, "Please do not add new test cases here."
+ assert len(tests) < 14, "Please do not add new test cases here."
return tests