summaryrefslogtreecommitdiff
path: root/tests/functional/a
diff options
context:
space:
mode:
authorMark Byrne <31762852+mbyrnepr2@users.noreply.github.com>2022-09-02 09:35:16 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-09-06 23:33:59 +0200
commit7a1fbb9f9aa8d1938ad768ff3d0403aa7d0c4bfb (patch)
treef0adc95fe012de9a8cdd49e691e0d8a77153b7d9 /tests/functional/a
parenta10406ab31725993b9c6b44154d71166f10e248d (diff)
downloadpylint-git-7a1fbb9f9aa8d1938ad768ff3d0403aa7d0c4bfb.tar.gz
Fix false positive for ``too-many-function-args`` when a function call is assigned to a class attribute inside the class where the function is defined. (#7395)
Closes #6592
Diffstat (limited to 'tests/functional/a')
-rw-r--r--tests/functional/a/arguments.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/functional/a/arguments.py b/tests/functional/a/arguments.py
index a065e517e..6929b9850 100644
--- a/tests/functional/a/arguments.py
+++ b/tests/functional/a/arguments.py
@@ -1,6 +1,6 @@
# pylint: disable=too-few-public-methods, missing-docstring,import-error,wrong-import-position
# pylint: disable=wrong-import-order, unnecessary-lambda, consider-using-f-string
-# pylint: disable=unnecessary-lambda-assignment
+# pylint: disable=unnecessary-lambda-assignment, no-self-argument, unused-argument
def decorator(fun):
"""Decorator"""
@@ -261,3 +261,20 @@ def func(one, two, three):
CALL = lambda *args: func(*args)
+
+
+# Ensure `too-many-function-args` is not emitted when a function call is assigned
+# to a class attribute inside the class where the function is defined.
+# Reference: https://github.com/PyCQA/pylint/issues/6592
+class FruitPicker:
+ def _pick_fruit(fruit):
+ def _print_selection(self):
+ print(f"Selected: {fruit}!")
+ return _print_selection
+
+ pick_apple = _pick_fruit("apple")
+ pick_pear = _pick_fruit("pear")
+
+picker = FruitPicker()
+picker.pick_apple()
+picker.pick_pear()