summaryrefslogtreecommitdiff
path: root/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py
blob: 9ebfbb30b070c5aa6378b57741fb2f31a7a384dd (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
"""Tests for missing-yield-doc and missing-yield-type-doc for Google style docstrings"""
# pylint: disable=missing-function-docstring, unused-argument, function-redefined
# pylint: disable=invalid-name, undefined-variable
import typing


# Test redundant yields docstring variants
def my_func(self):
    """This is a docstring.

    Yields:
        int or None: One, or sometimes None.
    """
    if a_func():
        yield None
    yield 1


def my_func(self):  # [redundant-yields-doc]
    """This is a docstring.

    Yields:
        int: One
    """
    return 1


# Test missing yields typing docstring
def generator() -> typing.Iterator[int]:
    """A simple function for checking type hints.

    Yields:
        The number 0
    """
    yield 0