diff options
Diffstat (limited to 'tests/functional/ext/docparams/return/missing_return_doc_Google.py')
-rw-r--r-- | tests/functional/ext/docparams/return/missing_return_doc_Google.py | 100 |
1 files changed, 99 insertions, 1 deletions
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_Google.py b/tests/functional/ext/docparams/return/missing_return_doc_Google.py index ba530484b..498dbf119 100644 --- a/tests/functional/ext/docparams/return/missing_return_doc_Google.py +++ b/tests/functional/ext/docparams/return/missing_return_doc_Google.py @@ -1,6 +1,7 @@ """Tests for missing-return-doc and missing-return-type-doc for Google style docstrings""" # pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring -# pylint: disable=unused-argument +# pylint: disable=unused-argument, too-few-public-methods, unnecessary-pass +import abc def my_func(self): @@ -75,3 +76,100 @@ def my_func(self): if a_func(): return None return 1 + + +class Foo: + """test_finds_property_return_type_google + Example of a property having return documentation in + a Google style docstring + """ + + @property + def foo_method(self): + """int: docstring ... + + Raises: + RuntimeError: Always + """ + raise RuntimeError() + return 10 # [unreachable] + + +class Foo: + """test_finds_annotation_property_return_type_google + Example of a property having return documentation in + a Google style docstring + """ + + @property + def foo_method(self) -> int: + """docstring ... + + Raises: + RuntimeError: Always + """ + raise RuntimeError() + return 10 # [unreachable] + + +class Foo: + """test_ignores_return_in_abstract_method_google + Example of an abstract method documenting the return type that an + implementation should return. + """ + + @abc.abstractmethod + def foo_method(self): + """docstring ... + + Returns: + int: Ten + """ + return 10 + + +class Foo: + """test_ignores_return_in_abstract_method_google_2 + Example of a method documenting the return type that an + implementation should return. + """ + + def foo_method(self, arg): + """docstring ... + + Args: + arg (int): An argument. + """ + raise NotImplementedError() + + +class Foo: + """test_ignores_ignored_argument_names_google + Example of a method documenting the return type that an + implementation should return. + """ + + def foo_method(self, arg, _): + """docstring ... + + Args: + arg (int): An argument. + """ + pass + + +class Foo: + """test_useless_docs_ignored_argument_names_google + Example of a method documenting the return type that an + implementation should return. + """ + + def foo_method(self, arg, _, _ignored): # [useless-type-doc, useless-param-doc] + """docstring ... + + Args: + arg (int): An argument. + _ (float): Another argument. + _ignored: Ignored argument. + """ + pass |