Skip to content

CI/DOC: Fixing bug in validate_docstrings.py #23543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/tests/test_validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ def method(self, foo=None, bar=None):
"""
pass

def private_classes(self):
"""
This mentions NDFrame, which is not correct.
"""


class BadSummaries(object):

Expand Down Expand Up @@ -688,7 +693,8 @@ def test_bad_class(self):

@capture_stderr
@pytest.mark.parametrize("func", [
'func', 'astype', 'astype1', 'astype2', 'astype3', 'plot', 'method'])
'func', 'astype', 'astype1', 'astype2', 'astype3', 'plot', 'method',
'private_classes'])
def test_bad_generic_functions(self, func):
errors = validate_one(self._import_path( # noqa:F821
klass='BadGenericDocStrings', func=func))['errors']
Expand All @@ -697,6 +703,9 @@ def test_bad_generic_functions(self, func):

@pytest.mark.parametrize("klass,func,msgs", [
# See Also tests
('BadGenericDocStrings', 'private_classes',
("Private classes (NDFrame) should not be mentioned in public "
'docstrings',)),
('BadSeeAlso', 'desc_no_period',
('Missing period at end of description for See Also "Series.iloc"',)),
('BadSeeAlso', 'desc_first_letter_lowercase',
Expand Down
5 changes: 3 additions & 2 deletions scripts/validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
'quotes)',
'GL03': 'Use only one blank line to separate sections or paragraphs',
'GL04': 'Private classes ({mentioned_private_classes}) should not be '
'mentioned in public docstring',
'mentioned in public docstrings',
'GL05': 'Tabs found at the start of line "{line_with_tabs}", please use '
'whitespace only',
'SS01': 'No summary found (a short summary in a single line should be '
Expand Down Expand Up @@ -562,7 +562,8 @@ def validate_one(func_name):
errs.append(error('GL03'))
mentioned_errs = doc.mentioned_private_classes
if mentioned_errs:
errs.append(error('GL04'), mentioned_private_classes=mentioned_errs)
errs.append(error('GL04',
mentioned_private_classes=', '.join(mentioned_errs)))
for line in doc.raw_doc.splitlines():
if re.match("^ *\t", line):
errs.append(error('GL05', line_with_tabs=line.lstrip()))
Expand Down