From 7deb297b65cd93c3fbc795adb254d8e068449a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Fri, 2 Sep 2022 10:54:48 +0200 Subject: [PATCH] Fix two! --- pylint/extensions/_check_docs_utils.py | 4 ++++ .../docparams/parameter/missing_param_doc_required_Numpy.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py index 8d1fb542a9..d8f797b6c5 100644 --- a/pylint/extensions/_check_docs_utils.py +++ b/pylint/extensions/_check_docs_utils.py @@ -813,6 +813,10 @@ def match_param_docs(self) -> tuple[set[str], set[str]]: # should be if param_type is None and re.match(r"\s*(\*{0,2}\w+)\s*:.+$", entry): param_type = param_desc + # If the description is "" but we have a type description + # we consider the description to be the type + if not param_desc and param_type: + param_desc = param_type if param_type: params_with_type.add(param_name) diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py index db383d182f..5626ad385b 100644 --- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py +++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py @@ -409,7 +409,7 @@ def test_with_list_of_default_values(arg, option, option2): return arg, option, option2 -def test_with_descriptions_instead_of_typing(arg, option): +def test_with_descriptions_instead_of_typing(arg, axis, option): """We choose to accept description in place of typing as well. See: https://github.com/PyCQA/pylint/pull/7398. @@ -417,6 +417,7 @@ def test_with_descriptions_instead_of_typing(arg, option): Parameters ---------- arg : a number type. + axis : int or None option : {"y", "n"} Do I do it? """