summaryrefslogtreecommitdiff
path: root/tests/extensions/test_check_docs.py
diff options
context:
space:
mode:
authorLuigi <luigi.cristofolini@q-ctrl.com>2020-09-18 17:18:06 +1000
committerLuigi <luigi.cristofolini@q-ctrl.com>2020-09-18 17:18:06 +1000
commit781df0eae15947fc1f13ae3ee66eb2cd4402819f (patch)
tree0ee262e352527b6d6e819b5031b8c51d2bc9a1e1 /tests/extensions/test_check_docs.py
parent4980369e6dcee8929b881dc9ec365523cd8d82b3 (diff)
downloadpylint-git-781df0eae15947fc1f13ae3ee66eb2cd4402819f.tar.gz
Adds support to `ignored-argument-names` in DocstringParameterChecker
Diffstat (limited to 'tests/extensions/test_check_docs.py')
-rw-r--r--tests/extensions/test_check_docs.py125
1 files changed, 125 insertions, 0 deletions
diff --git a/tests/extensions/test_check_docs.py b/tests/extensions/test_check_docs.py
index 0ed6cb8a7..75d448ce0 100644
--- a/tests/extensions/test_check_docs.py
+++ b/tests/extensions/test_check_docs.py
@@ -2156,3 +2156,128 @@ class TestParamDocChecker(CheckerTestCase):
)
with self.assertNoMessages():
self.checker.visit_functiondef(node)
+
+ def test_ignores_ignored_argument_names_sphinx(self):
+ """Example of a method documenting the return type that an
+ implementation should return.
+ """
+ node = astroid.extract_node(
+ """
+ class Foo(object):
+ def foo(self, arg, _): #@
+ '''docstring ...
+
+ :param arg: An argument.
+ :type arg: int
+ '''
+ raise NotImplementedError()
+ """
+ )
+ with self.assertNoMessages():
+ self.checker.visit_functiondef(node)
+
+ def test_ignores_ignored_argument_names_google(self):
+ """Example of a method documenting the return type that an
+ implementation should return.
+ """
+ node = astroid.extract_node(
+ """
+ class Foo(object):
+ def foo(self, arg, _): #@
+ '''docstring ...
+
+ Args:
+ arg (int): An argument.
+ '''
+ raise NotImplementedError()
+ """
+ )
+ with self.assertNoMessages():
+ self.checker.visit_functiondef(node)
+
+ def test_ignores_ignored_argument_names_numpy(self):
+ """Example of a method documenting the return type that an
+ implementation should return.
+ """
+ node = astroid.extract_node(
+ """
+ class Foo(object):
+ def foo(self, arg, _): #@
+ '''docstring ...
+
+ Parameters
+ ----------
+ arg : int
+ An argument.
+ '''
+ raise NotImplementedError()
+ """
+ )
+ with self.assertNoMessages():
+ self.checker.visit_functiondef(node)
+
+ def test_accepts_ignored_argument_names_sphinx(self):
+ """Example of a method documenting the return type that an
+ implementation should return.
+ """
+ node = astroid.extract_node(
+ """
+ class Foo(object):
+ def foo(self, arg, _): #@
+ '''docstring ...
+
+ :param arg: An argument.
+ :type arg: int
+
+ :param _: Another argument.
+ :type _: float
+ '''
+ raise NotImplementedError()
+ """
+ )
+ with self.assertNoMessages():
+ self.checker.visit_functiondef(node)
+
+ def test_accepts_ignored_argument_names_google(self):
+ """Example of a method documenting the return type that an
+ implementation should return.
+ """
+ node = astroid.extract_node(
+ """
+ class Foo(object):
+ def foo(self, arg, _): #@
+ '''docstring ...
+
+ Args:
+ arg (int): An argument.
+ _ (float): Another argument.
+ '''
+ raise NotImplementedError()
+ """
+ )
+ with self.assertNoMessages():
+ self.checker.visit_functiondef(node)
+
+ def test_accepts_ignored_argument_names_numpy(self):
+ """Example of a method documenting the return type that an
+ implementation should return.
+ """
+ node = astroid.extract_node(
+ """
+ class Foo(object):
+ def foo(self, arg, _): #@
+ '''docstring ...
+
+ Parameters
+ ----------
+ arg : int
+ An argument.
+
+ _ : float
+ Another argument.
+ '''
+ raise NotImplementedError()
+ """
+ )
+ with self.assertNoMessages():
+ self.checker.visit_functiondef(node)