diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-01-09 13:36:45 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-01-09 13:36:45 +0200 |
commit | d2a7144d29a6576f79c0f8fba4ff4707447c3f79 (patch) | |
tree | 2a5cc7efdd3d8c4220cd5cd0947c0dd14708c092 /pylint/test | |
parent | 5416db5a9201e3930068efda335e7040273d95fc (diff) | |
download | pylint-git-d2a7144d29a6576f79c0f8fba4ff4707447c3f79.tar.gz |
Take in account kwonlyargs when verifying that arguments are defined
Closes #745
Diffstat (limited to 'pylint/test')
-rw-r--r-- | pylint/test/extensions/test_check_docs.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pylint/test/extensions/test_check_docs.py b/pylint/test/extensions/test_check_docs.py index 3a5455a46..a8ae5fd7a 100644 --- a/pylint/test/extensions/test_check_docs.py +++ b/pylint/test/extensions/test_check_docs.py @@ -4,6 +4,7 @@ in particular the parameter documentation checker `ParamDocChecker` from __future__ import division, print_function, absolute_import import unittest +import sys import astroid from astroid import test_utils @@ -639,6 +640,27 @@ class ParamDocCheckerTest(CheckerTestCase): ): self._visit_methods_of_class(node) + @unittest.skipIf(sys.version_info[0] != 3, "Enabled on Python 3") + def test_kwonlyargs_are_taken_in_account(self): + node = test_utils.extract_node(''' + def my_func(arg, *, kwonly, missing_kwonly): + """The docstring + + :param int arg: The argument. + :param bool kwonly: A keyword-arg. + """ + ''') + with self.assertAddsMessages( + Message( + msg_id='missing-param-doc', + node=node, + args=('missing_kwonly', )), + Message( + msg_id='missing-type-doc', + node=node, + args=('missing_kwonly', ))): + self.checker.visit_functiondef(node) + if __name__ == '__main__': unittest.main() |