summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2021-11-29 20:09:28 +0100
committerGitHub <noreply@github.com>2021-11-29 20:09:28 +0100
commitf761b3210013d686f9db5e96f7b69dbf32f14b41 (patch)
tree080ee2417ccc5e599c92e7a7ed4cb8717f9bb79f /tests
parent3652faeb5e220a420fba2bb7131c9525beaa8365 (diff)
downloadpylint-git-f761b3210013d686f9db5e96f7b69dbf32f14b41.tar.gz
Move ``TestDocstringCheckerYield`` to functional tests (#5435)
Diffstat (limited to 'tests')
-rw-r--r--tests/extensions/test_check_yields_docs.py514
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc.py12
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc.rc2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Google.py35
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Google.rc2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Google.txt1
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py30
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.rc2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.txt1
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py13
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.rc2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required.py7
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required.rc5
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required.txt2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.py67
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.rc5
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.txt5
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.py58
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.rc5
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.txt3
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.py65
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.rc5
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.txt5
23 files changed, 332 insertions, 514 deletions
diff --git a/tests/extensions/test_check_yields_docs.py b/tests/extensions/test_check_yields_docs.py
deleted file mode 100644
index e4ae70770..000000000
--- a/tests/extensions/test_check_yields_docs.py
+++ /dev/null
@@ -1,514 +0,0 @@
-# Copyright (c) 2016-2018, 2020 Claudiu Popa <pcmanticore@gmail.com>
-# Copyright (c) 2016, 2019 Ashley Whetter <ashley@awhetter.co.uk>
-# Copyright (c) 2016 Derek Gustafson <degustaf@gmail.com>
-# Copyright (c) 2016 Glenn Matthews <glenn@e-dad.net>
-# Copyright (c) 2019-2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
-# Copyright (c) 2019 Hugo van Kemenade <hugovk@users.noreply.github.com>
-# Copyright (c) 2020 hippo91 <guillaume.peillex@gmail.com>
-# Copyright (c) 2021 Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
-# Copyright (c) 2021 Marc Mueller <30130371+cdce8p@users.noreply.github.com>
-
-# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-
-"""Unit tests for the yield documentation checking in the
-`DocstringChecker` in :mod:`pylint.extensions.check_docs`
-"""
-
-# pylint: disable=too-many-public-methods
-
-import astroid
-
-from pylint.extensions.docparams import DocstringParameterChecker
-from pylint.testutils import CheckerTestCase, MessageTest, set_config
-
-
-class TestDocstringCheckerYield(CheckerTestCase):
- """Tests for pylint_plugin.RaiseDocChecker"""
-
- CHECKER_CLASS = DocstringParameterChecker
-
- def test_ignores_no_docstring(self) -> None:
- yield_node = astroid.extract_node(
- """
- def my_func(self):
- yield False #@
- """
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc=False)
- def test_warns_no_docstring(self) -> None:
- node = astroid.extract_node(
- """
- def my_func(self):
- yield False
- """
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node),
- MessageTest(msg_id="missing-yield-type-doc", node=node),
- ):
- self.checker.visit_yield(yield_node)
-
- def test_ignores_unknown_style(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring."""
- yield False #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_partial_sphinx_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- :returns: Always False
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-type-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_partial_sphinx_yields_type(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- :rtype: bool
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_missing_sphinx_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self, doc_type):
- """This is a docstring.
-
- :param doc_type: Sphinx
- :type doc_type: str
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node),
- MessageTest(msg_id="missing-yield-type-doc", node=node),
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_partial_google_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- Always False
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-type-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_partial_google_yields_type(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- bool:
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_missing_google_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self, doc_type):
- """This is a docstring.
-
- Parameters:
- doc_type (str): Google
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node),
- MessageTest(msg_id="missing-yield-type-doc", node=node),
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warn_missing_numpy_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self, doc_type):
- """This is a docstring.
-
- Arguments
- ---------
- doc_type : str
- Numpy
- """
- yield False
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node),
- MessageTest(msg_id="missing-yield-type-doc", node=node),
- ):
- self.checker.visit_yield(yield_node)
-
- def test_find_sphinx_yields(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- :return: Always False
- :rtype: bool
- """
- yield False #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_find_google_yields(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- bool: Always False
- """
- yield False #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_find_numpy_yields(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields
- -------
- bool
- Always False
- """
- yield False #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_finds_sphinx_yield_custom_class(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- :returns: An object
- :rtype: :class:`mymodule.Class`
- """
- yield mymodule.Class() #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_finds_google_yield_custom_class(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- mymodule.Class: An object
- """
- yield mymodule.Class() #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_finds_numpy_yield_custom_class(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields
- -------
- mymodule.Class
- An object
- """
- yield mymodule.Class() #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_finds_sphinx_yield_list_of_custom_class(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- :returns: An object
- :rtype: list(:class:`mymodule.Class`)
- """
- yield [mymodule.Class()] #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_finds_google_yield_list_of_custom_class(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- list(:class:`mymodule.Class`): An object
- """
- yield [mymodule.Class()] #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_finds_numpy_yield_list_of_custom_class(self) -> None:
- yield_node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields
- -------
- list(:class:`mymodule.Class`)
- An object
- """
- yield [mymodule.Class()] #@
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warns_sphinx_yield_list_of_custom_class_without_description(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- :rtype: list(:class:`mymodule.Class`)
- """
- yield [mymodule.Class()]
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warns_google_yield_list_of_custom_class_without_description(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- list(:class:`mymodule.Class`):
- """
- yield [mymodule.Class()]
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- @set_config(accept_no_yields_doc="no")
- def test_warns_numpy_yield_list_of_custom_class_without_description(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields
- -------
- list(:class:`mymodule.Class`)
- """
- yield [mymodule.Class()]
- '''
- )
- yield_node = node.body[0]
- with self.assertAddsMessages(
- MessageTest(msg_id="missing-yield-doc", node=node)
- ):
- self.checker.visit_yield(yield_node)
-
- # No such thing as redundant yield documentation for sphinx because it
- # doesn't support yield documentation
-
- def test_ignores_google_redundant_yield_doc_multiple_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- int or None: One, or sometimes None.
- """
- if a_func():
- yield None
- yield 1
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_functiondef(node)
-
- def test_ignores_numpy_redundant_yield_doc_multiple_yields(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields
- -------
- int
- One
- None
- Sometimes
- """
- if a_func():
- yield None
- yield 1
- '''
- )
- with self.assertNoMessages():
- self.checker.visit_functiondef(node)
-
- # No such thing as redundant yield documentation for sphinx because it
- # doesn't support yield documentation
-
- def test_warns_google_redundant_yield_doc_return(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields:
- int: One
- """
- return 1
- '''
- )
- with self.assertAddsMessages(
- MessageTest(msg_id="redundant-yields-doc", node=node)
- ):
- self.checker.visit_functiondef(node)
-
- def test_warns_numpy_redundant_yield_doc_return(self) -> None:
- node = astroid.extract_node(
- '''
- def my_func(self):
- """This is a docstring.
-
- Yields
- -------
- int
- One
- """
- return 1
- '''
- )
- with self.assertAddsMessages(
- MessageTest(msg_id="redundant-yields-doc", node=node)
- ):
- self.checker.visit_functiondef(node)
-
- def test_sphinx_missing_yield_type_with_annotations(self) -> None:
- node = astroid.extract_node(
- '''
- import typing
-
- def generator() -> typing.Iterator[int]:
- """A simple function for checking type hints.
-
- :returns: The number 0
- """
- yield 0
- '''
- )
- yield_node = node.body[0]
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
-
- def test_google_missing_yield_type_with_annotations(self) -> None:
- node = astroid.extract_node(
- '''
- import typing
-
- def generator() -> typing.Iterator[int]:
- """A simple function for checking type hints.
-
- Yields:
- The number 0
- """
- yield 0
- '''
- )
- yield_node = node.body[0]
- with self.assertNoMessages():
- self.checker.visit_yield(yield_node)
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc.py b/tests/functional/ext/docparams/yield/missing_yield_doc.py
new file mode 100644
index 000000000..331b7f9bf
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc.py
@@ -0,0 +1,12 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+
+# Ignore no docstring
+def my_func(self):
+ yield False
+
+
+# Ignore unrecognized style docstring
+def my_func(self):
+ """This is a docstring."""
+ yield False
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc.rc b/tests/functional/ext/docparams/yield/missing_yield_doc.rc
new file mode 100644
index 000000000..3c410593d
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc.rc
@@ -0,0 +1,2 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py
new file mode 100644
index 000000000..986ca8d08
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py
@@ -0,0 +1,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 redudant 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
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Google.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.rc
new file mode 100644
index 000000000..3c410593d
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.rc
@@ -0,0 +1,2 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Google.txt b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.txt
new file mode 100644
index 000000000..febb5f9ba
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.txt
@@ -0,0 +1 @@
+redundant-yields-doc:19:0:25:12:my_func:Redundant yields documentation:UNDEFINED
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py
new file mode 100644
index 000000000..bd6a4a0fe
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py
@@ -0,0 +1,30 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc for Numpy style docstrings"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+# pylint: disable=invalid-name, undefined-variable
+
+
+# Test redudant yields docstring variants
+def my_func(self):
+ """This is a docstring.
+
+ Yields
+ -------
+ int
+ One
+ None
+ Sometimes
+ """
+ if a_func():
+ yield None
+ yield 1
+
+
+def my_func(self): # [redundant-yields-doc]
+ """This is a docstring.
+
+ Yields
+ -------
+ int
+ One
+ """
+ return 1
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.rc
new file mode 100644
index 000000000..3c410593d
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.rc
@@ -0,0 +1,2 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.txt b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.txt
new file mode 100644
index 000000000..b855ed84d
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.txt
@@ -0,0 +1 @@
+redundant-yields-doc:22:0:30:12:my_func:Redundant yields documentation:UNDEFINED
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py b/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py
new file mode 100644
index 000000000..850c8b128
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py
@@ -0,0 +1,13 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc for Sphinx style docstrings"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+# pylint: disable=invalid-name, undefined-variable
+import typing
+
+
+# Test missing yields typing docstring
+def generator() -> typing.Iterator[int]:
+ """A simple function for checking type hints.
+
+ :returns: The number 0
+ """
+ yield 0
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.rc
new file mode 100644
index 000000000..3c410593d
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.rc
@@ -0,0 +1,2 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required.py b/tests/functional/ext/docparams/yield/missing_yield_doc_required.py
new file mode 100644
index 000000000..e307063b3
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required.py
@@ -0,0 +1,7 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc with accept-no-yields-doc = no"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+
+
+# Test missing docstring
+def my_func(self): # [missing-yield-doc, missing-yield-type-doc]
+ yield False
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_required.rc
new file mode 100644
index 000000000..ee2ac61f2
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required.rc
@@ -0,0 +1,5 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
+
+[BASIC]
+accept-no-yields-doc=no
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required.txt b/tests/functional/ext/docparams/yield/missing_yield_doc_required.txt
new file mode 100644
index 000000000..16a4f535c
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required.txt
@@ -0,0 +1,2 @@
+missing-yield-doc:6:0:7:15:my_func:Missing yield documentation:UNDEFINED
+missing-yield-type-doc:6:0:7:15:my_func:Missing yield type documentation:UNDEFINED
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.py b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.py
new file mode 100644
index 000000000..b9a16d1c6
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.py
@@ -0,0 +1,67 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc for Google style docstrings
+with accept-no-yields-doc = no"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+# pylint: disable=invalid-name, undefined-variable
+
+
+def my_func(self):
+ """This is a docstring.
+
+ Yields:
+ bool: Always False
+ """
+ yield False
+
+
+def my_func(self):
+ """This is a docstring.
+
+ Yields:
+ mymodule.Class: An object
+ """
+ yield mymodule.Class()
+
+
+def my_func(self):
+ """This is a docstring.
+
+ Yields:
+ list(:class:`mymodule.Class`): An object
+ """
+ yield [mymodule.Class()]
+
+
+def my_func(self): # [missing-yield-doc]
+ """This is a docstring.
+
+ Yields:
+ list(:class:`mymodule.Class`):
+ """
+ yield [mymodule.Class()]
+
+
+def my_func(self): # [missing-yield-type-doc]
+ """This is a docstring.
+
+ Yields:
+ Always False
+ """
+ yield False
+
+
+def my_func(self): # [missing-yield-doc]
+ """This is a docstring.
+
+ Yields:
+ bool:
+ """
+ yield False
+
+
+def my_func(self, doc_type): # [missing-yield-doc, missing-yield-type-doc]
+ """This is a docstring.
+
+ Parameters:
+ doc_type (str): Google
+ """
+ yield False
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.rc
new file mode 100644
index 000000000..ee2ac61f2
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.rc
@@ -0,0 +1,5 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
+
+[BASIC]
+accept-no-yields-doc=no
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.txt b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.txt
new file mode 100644
index 000000000..e1d808718
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Google.txt
@@ -0,0 +1,5 @@
+missing-yield-doc:34:0:40:28:my_func:Missing yield documentation:UNDEFINED
+missing-yield-type-doc:43:0:49:15:my_func:Missing yield type documentation:UNDEFINED
+missing-yield-doc:52:0:58:15:my_func:Missing yield documentation:UNDEFINED
+missing-yield-doc:61:0:67:15:my_func:Missing yield documentation:UNDEFINED
+missing-yield-type-doc:61:0:67:15:my_func:Missing yield type documentation:UNDEFINED
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.py b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.py
new file mode 100644
index 000000000..8b5472a48
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.py
@@ -0,0 +1,58 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc for Numpy style docstrings
+with accept-no-yields-doc = no"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+# pylint: disable=invalid-name, undefined-variable
+
+
+def my_func(self):
+ """This is a docstring.
+
+ Yields
+ -------
+ bool
+ Always False
+ """
+ yield False
+
+
+def my_func(self):
+ """This is a docstring.
+
+ Yields
+ -------
+ mymodule.Class
+ An object
+ """
+ yield mymodule.Class()
+
+
+def my_func(self):
+ """This is a docstring.
+
+ Yields
+ -------
+ list(:class:`mymodule.Class`)
+ An object
+ """
+ yield [mymodule.Class()]
+
+
+def my_func(self): # [missing-yield-doc]
+ """This is a docstring.
+
+ Yields
+ -------
+ list(:class:`mymodule.Class`)
+ """
+ yield [mymodule.Class()]
+
+
+def my_func(self, doc_type): # [missing-yield-doc, missing-yield-type-doc]
+ """This is a docstring.
+
+ Arguments
+ ---------
+ doc_type : str
+ Numpy
+ """
+ yield False
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.rc
new file mode 100644
index 000000000..ee2ac61f2
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.rc
@@ -0,0 +1,5 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
+
+[BASIC]
+accept-no-yields-doc=no
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.txt b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.txt
new file mode 100644
index 000000000..26e5989f4
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Numpy.txt
@@ -0,0 +1,3 @@
+missing-yield-doc:40:0:47:28:my_func:Missing yield documentation:UNDEFINED
+missing-yield-doc:50:0:58:15:my_func:Missing yield documentation:UNDEFINED
+missing-yield-type-doc:50:0:58:15:my_func:Missing yield type documentation:UNDEFINED
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.py b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.py
new file mode 100644
index 000000000..9378482f4
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.py
@@ -0,0 +1,65 @@
+"""Tests for missing-yield-doc and missing-yield-type-doc for Sphinx style docstrings
+with accept-no-yields-doc = no"""
+# pylint: disable=missing-function-docstring, unused-argument, function-redefined
+# pylint: disable=invalid-name, undefined-variable
+
+
+# Test Sphinx docstring
+def my_func(self):
+ """This is a docstring.
+
+ :return: Always False
+ :rtype: bool
+ """
+ yield False
+
+
+def my_func(self):
+ """This is a docstring.
+
+ :returns: An object
+ :rtype: :class:`mymodule.Class`
+ """
+ yield mymodule.Class()
+
+
+def my_func(self):
+ """This is a docstring.
+
+ :returns: An object
+ :rtype: list(:class:`mymodule.Class`)
+ """
+ yield [mymodule.Class()]
+
+
+def my_func(self): # [missing-yield-doc]
+ """This is a docstring.
+
+ :rtype: list(:class:`mymodule.Class`)
+ """
+ yield [mymodule.Class()]
+
+
+def my_func(self): # [missing-yield-type-doc]
+ """This is a docstring.
+
+ :returns: Always False
+ """
+ yield False
+
+
+def my_func(self): # [missing-yield-doc]
+ """This is a docstring.
+
+ :rtype: bool
+ """
+ yield False
+
+
+def my_func(self, doc_type): # [missing-yield-doc, missing-yield-type-doc]
+ """This is a docstring.
+
+ :param doc_type: Sphinx
+ :type doc_type: str
+ """
+ yield False
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.rc b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.rc
new file mode 100644
index 000000000..ee2ac61f2
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.rc
@@ -0,0 +1,5 @@
+[MASTER]
+load-plugins = pylint.extensions.docparams
+
+[BASIC]
+accept-no-yields-doc=no
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.txt b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.txt
new file mode 100644
index 000000000..ca4744af2
--- /dev/null
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_required_Sphinx.txt
@@ -0,0 +1,5 @@
+missing-yield-doc:35:0:40:28:my_func:Missing yield documentation:UNDEFINED
+missing-yield-type-doc:43:0:48:15:my_func:Missing yield type documentation:UNDEFINED
+missing-yield-doc:51:0:56:15:my_func:Missing yield documentation:UNDEFINED
+missing-yield-doc:59:0:65:15:my_func:Missing yield documentation:UNDEFINED
+missing-yield-type-doc:59:0:65:15:my_func:Missing yield type documentation:UNDEFINED