summaryrefslogtreecommitdiff
path: root/tests/data
diff options
context:
space:
mode:
authorTéo Bouvard <teobouvard@gmail.com>2022-03-09 17:43:40 +0100
committerGitHub <noreply@github.com>2022-03-09 17:43:40 +0100
commit1ebdc8c59f31962db0244a79eaab9b8d90a87baf (patch)
tree30e3ec2963f3109a8371b38217f4318aca04835e /tests/data
parentb1bb7f86bf08876e909fe135802a262fb2e5d82f (diff)
downloadpylint-git-1ebdc8c59f31962db0244a79eaab9b8d90a87baf.tar.gz
Fix pyreverse type hinting for class methods (#5881)
* Fix pyreverse type hinting for class methods This commit fixes the alignment of arguments and their type annotations in pyreverse printer output. It does so by checking for the type of the current function rather than the name of the first argument. This allows class methods having a non-standard first argument (different from "self" or "cls") to be correctly serialized in class diagrams. * Add test for method with None args According to astroid docs, this happens for builtin functions implemented in C. In this case, we return an empty argument list.
Diffstat (limited to 'tests/data')
-rw-r--r--tests/data/clientmodule_test.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/data/clientmodule_test.py b/tests/data/clientmodule_test.py
index 82deaaf6f..257aadec1 100644
--- a/tests/data/clientmodule_test.py
+++ b/tests/data/clientmodule_test.py
@@ -28,3 +28,11 @@ class Specialization(Ancestor):
self._id = _id
self.relation = DoNothing()
self.relation2 = relation2
+
+ @classmethod
+ def from_value(cls, value: int):
+ return cls(value, 0, DoNothing2())
+
+ @staticmethod
+ def transform_value(value: int) -> int:
+ return value * 2