diff options
author | Bruno Daniel <bruno.daniel@blue-yonder.com> | 2015-05-10 12:54:03 +0200 |
---|---|---|
committer | Bruno Daniel <bruno.daniel@blue-yonder.com> | 2015-05-10 12:54:03 +0200 |
commit | f816293b6bc8ceb7089ea5cf03b63b06b3491893 (patch) | |
tree | ed09246a0fb2e709a28fd87340a3a231ef2d9c4d /pylint/extensions | |
parent | 27a8e02485b079723862c67c5240d9ca0aa684d5 (diff) | |
download | pylint-f816293b6bc8ceb7089ea5cf03b63b06b3491893.tar.gz |
unit tests for correctly documented parameters and return values (all 3 styles)
Diffstat (limited to 'pylint/extensions')
-rw-r--r-- | pylint/extensions/test/test_check_docs.py | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/pylint/extensions/test/test_check_docs.py b/pylint/extensions/test/test_check_docs.py index 642ceb1..47b264f 100644 --- a/pylint/extensions/test/test_check_docs.py +++ b/pylint/extensions/test/test_check_docs.py @@ -209,9 +209,9 @@ class SpinxDocCheckerTest(CheckerTestCase): ): self.checker.visit_class(node) - def test_existing_func_params_in_docstring(self): + def test_existing_func_params_in_sphinx_docstring(self): """Example of a function with correctly documented parameters and - return values + return values (Sphinx style) """ node = test_utils.extract_node(""" def function_foo(xarg, yarg, zarg): @@ -233,6 +233,57 @@ class SpinxDocCheckerTest(CheckerTestCase): with self.assertNoMessages(): self.checker.visit_function(node) + def test_existing_func_params_in_google_docstring(self): + """Example of a function with correctly documented parameters and + return values (Google style) + """ + node = test_utils.extract_node(""" + def function_foo(xarg, yarg, zarg): + '''function foo ... + + Args: + xarg (int): bla xarg + yarg (float): bla + bla yarg + + zarg (int): bla zarg + + Returns: + sum (float) + ''' + return xarg + yarg + """) + with self.assertNoMessages(): + self.checker.visit_function(node) + + def test_existing_func_params_in_numpy_docstring(self): + """Example of a function with correctly documented parameters and + return values (Numpy style) + """ + node = test_utils.extract_node(""" + def function_foo(xarg, yarg, zarg): + '''function foo ... + + Parameters + ---------- + xarg: int + bla xarg + yarg: float + bla yarg + + zarg: int + bla zarg + + Returns + ------- + float + sum + ''' + return xarg + yarg + """) + with self.assertNoMessages(): + self.checker.visit_function(node) + def test_wrong_name_of_func_params_in_docstring(self): """Example of functions with inconsistent parameter names in the signature and in the documentation |