Skip to content

Commit

Permalink
Adding tests for no docstrings error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Volkov committed Nov 13, 2018
1 parent bba8b4d commit 50e85bf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/tests/test_validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ def missing_whitespace_after_comma(self):
pass


class NoDocstrings(object):

def method_wo_docstrings(self):
pass


class TestValidator(object):

def _import_path(self, klass=None, func=None):
Expand Down Expand Up @@ -720,6 +726,13 @@ def test_bad_class(self):
assert isinstance(errors, list)
assert errors

@capture_stderr
def test_bad_class(self):
errors = validate_one(self._import_path(
klass='NoDocstrings'))['errors']
assert isinstance(errors, list)
assert errors

@capture_stderr
@pytest.mark.parametrize("func", [
'func', 'astype', 'astype1', 'astype2', 'astype3', 'plot', 'method',
Expand Down Expand Up @@ -812,6 +825,8 @@ def test_bad_generic_functions(self, func):
'E226 missing whitespace around arithmetic operator',)),
('BadExamples', 'missing_whitespace_after_comma',
("flake8 error: E231 missing whitespace after ',' (3 times)",)),
('NoDocstrings', 'method_wo_docstrings',
(""))
])
def test_bad_examples(self, capsys, klass, func, msgs):
result = validate_one(self._import_path(klass=klass, func=func))
Expand Down

0 comments on commit 50e85bf

Please sign in to comment.