summaryrefslogtreecommitdiff
path: root/tests/functional/ext/docparams/return/missing_return_doc_required_Google.py
blob: 37546b34f9809d96e80f8b37f16e478ac9fb97be (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
"""Tests for missing-return-doc and missing-return-type-doc for Google style docstrings
with accept-no-returns-doc = no"""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, too-few-public-methods


def my_func(self):  # [missing-return-type-doc]
    """Warn partial google returns

    Returns:
        Always False
    """
    return False


def my_func(self):  # [missing-return-doc]
    """warn_partial_google_returns_type

    Returns:
        bool:
    """
    return False


def my_func(self, doc_type):  # [missing-return-doc, missing-return-type-doc]
    """warn_missing_google_returns

    Parameters:
        doc_type (str): Google
    """
    return False


def my_func(self):  # [missing-return-doc]
    """warns_google_return_list_of_custom_class_without_description

    Returns:
        list(:class:`mymodule.Class`):
    """
    return [mymodule.Class()]


class Foo:
    """test_finds_missing_property_return_type_google
    Example of a property having return documentation in
    a Google style docstring
    """

    @property
    def foo_method(self):  # [missing-return-type-doc]
        """docstring ...

        Raises:
            RuntimeError: Always
        """
        raise RuntimeError()
        return 10  # [unreachable]


class Foo:
    """test_ignores_non_property_return_type_google
    Example of a class function trying to use `type` as return
    documentation in a Google style docstring
    """

    def foo_method(self):  # [missing-return-doc, missing-return-type-doc]
        """int: docstring ...

        Raises:
            RuntimeError: Always
        """
        print(self)
        raise RuntimeError()
        return 10  # [unreachable]