summaryrefslogtreecommitdiff
path: root/tests/functional/ext/docparams/docparams.py
blob: 295cf430d6ea3d6faf9c8fc8285005dba881d2a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"""Fixture for testing missing documentation in docparams."""


def _private_func1(param1):  # [missing-return-doc, missing-return-type-doc]
    """This is a test docstring without returns"""
    return param1


def _private_func2(param1):  # [missing-yield-doc, missing-yield-type-doc]
    """This is a test docstring without yields"""
    yield param1


def _private_func3(param1):  # [missing-raises-doc]
    """This is a test docstring without raises"""
    raise Exception('Example')


def public_func1(param1):  # [missing-any-param-doc]
    """This is a test docstring without params"""
    print(param1)


async def _async_private_func1(param1):  # [missing-return-doc, missing-return-type-doc]
    """This is a test docstring without returns"""
    return param1


async def _async_private_func2(param1):  # [missing-yield-doc, missing-yield-type-doc]
    """This is a test docstring without yields"""
    yield param1


async def _async_private_func3(param1):  # [missing-raises-doc]
    """This is a test docstring without raises"""
    raise Exception('Example')


async def async_public_func1(param1):  # [missing-any-param-doc]
    """This is a test docstring without params"""
    print(param1)


def differing_param_doc(par1: int) -> int:  # [differing-param-doc]
    """This is a test docstring documenting one non-existing param

    :param par1: some param
    :param param: some param
    :return: the sum of the params
    """

    return par1


def differing_param_doc_kwords_only(*, par1: int) -> int:  # [differing-param-doc]
    """This is a test docstring documenting one non-existing param

    :param par1: some param
    :param param: some param
    :return: the sum of the params
    """

    return par1


def missing_type_doc(par1) -> int:  # [missing-type-doc]
    """This is a test docstring params where the type is not specified

    :param par1: some param
    :return: the param
    """

    return par1


def missing_type_doc_kwords_only(*, par1) -> int:  # [missing-type-doc]
    """This is a test docstring params where the type is not specified

    :param par1: some param
    :return: the param
    """

    return par1


def params_are_documented(par1: int, *, par2: int) -> int:
    """This is a test docstring params where nothing is raised as it is all documented

    :param par1: some param
    :param par2: some other param
    :return: the sum of params
    """

    return par1 + par2