Skip to content

Commit df99320

Browse files
Move tests from TestParamDocChecker to functional tests (#5509)
Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent 6c6a7aa commit df99320

20 files changed

+212
-305
lines changed

tests/extensions/test_check_docs.py

Lines changed: 0 additions & 301 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Tests for missing-param-doc and missing-type-doc for non-specified style docstrings
2+
with accept-no-param-doc = yes
3+
"""
4+
# pylint: disable=invalid-name, unused-argument
5+
6+
7+
def test_tolerate_no_param_documentation_at_all(x, y):
8+
"""Example of a function with no parameter documentation at all
9+
10+
No error message is emitted.
11+
12+
missing parameter documentation"""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[MASTER]
2+
load-plugins = pylint.extensions.docparams
3+
4+
[BASIC]
5+
accept-no-param-doc=yes
6+
docstring-min-length: -1
7+
no-docstring-rgx=^$
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Tests for missing-param-doc and missing-type-doc for non-specified style docstrings
2+
with accept-no-param-doc = no
3+
"""
4+
# pylint: disable=invalid-name, unused-argument, too-few-public-methods
5+
6+
7+
def test_don_t_tolerate_no_param_documentation_at_all(x, y): # [missing-any-param-doc]
8+
"""Example of a function with no parameter documentation at all
9+
10+
Missing documentation error message is emitted.
11+
12+
missing parameter documentation"""
13+
14+
15+
def test_see_tolerate_no_param_documentation_at_all(x, y):
16+
"""Example for the usage of "For the parameters, see"
17+
to suppress missing-param warnings.
18+
19+
For the parameters, see :func:`blah`
20+
"""
21+
22+
23+
class ClassFoo:
24+
"""Example usage of "For the parameters, see" in init docstring"""
25+
26+
def __init__(self, x, y):
27+
"""docstring foo constructor
28+
29+
For the parameters, see :func:`bla`
30+
"""
31+
32+
33+
class ClassFooTwo:
34+
"""test_see_sentence_for_constr_params_in_class
35+
Example usage of "For the parameters, see" in class docstring
36+
37+
For the parameters, see :func:`bla`
38+
"""
39+
40+
def __init__(self, x, y):
41+
"""init"""
42+
43+
44+
def test_kwonlyargs_are_taken_in_account( # [missing-param-doc, missing-type-doc]
45+
arg, *, kwonly, missing_kwonly
46+
):
47+
"""The docstring
48+
49+
:param int arg: The argument.
50+
:param bool kwonly: A keyword-arg.
51+
"""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[MASTER]
2+
load-plugins = pylint.extensions.docparams
3+
4+
[BASIC]
5+
accept-no-param-doc=no
6+
docstring-min-length: -1
7+
no-docstring-rgx=^$
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
missing-any-param-doc:7:0:12:38:test_don_t_tolerate_no_param_documentation_at_all:"Missing any documentation in ""test_don_t_tolerate_no_param_documentation_at_all""":UNDEFINED
2+
missing-param-doc:44:0:51:7:test_kwonlyargs_are_taken_in_account:"""missing_kwonly"" missing in parameter documentation":UNDEFINED
3+
missing-type-doc:44:0:51:7:test_kwonlyargs_are_taken_in_account:"""missing_kwonly"" missing in parameter type documentation":UNDEFINED
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Tests for missing-param-doc and missing-type-doc for non-specified style docstrings
2+
with accept-no-param-doc = no and docstring-min-length = 3
3+
"""
4+
# pylint: disable=invalid-name, unused-argument
5+
6+
# Example of a function that is less than 'docstring-min-length' config option
7+
# No error message is emitted.
8+
def test_skip_docstring_min_length(x, y):
9+
"""function is too short and is missing parameter documentation"""

0 commit comments

Comments
 (0)