Skip to content

Commit bc5f082

Browse files
committed
Give Warning on prefix pandas
1 parent 7e6864d commit bc5f082

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

scripts/tests/test_validate_docstrings.py

+11
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ def method(self, foo=None, bar=None):
334334
pass
335335

336336

337+
class BadSeeAlso(object):
338+
339+
def prefix_pandas(self):
340+
"""
341+
Return prefix with `pandas` from See Also sec
342+
"""
343+
pass
344+
337345
class BadSummaries(object):
338346

339347
def wrong_line(self):
@@ -564,6 +572,9 @@ def test_bad_generic_functions(self, func):
564572
assert errors
565573

566574
@pytest.mark.parametrize("klass,func,msgs", [
575+
#SeeAlso tests
576+
('BadSeeAlso', 'prefix_pandas',
577+
('Should not start with pandas',)),
567578
# Summary tests
568579
('BadSummaries', 'wrong_line',
569580
('should start in the line immediately after the opening quotes',)),

scripts/validate_docstrings.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ def validate_one(func_name):
499499
if not rel_desc:
500500
errs.append('Missing description for '
501501
'See Also "{}" reference'.format(rel_name))
502-
502+
if rel_name[:7].lower() == 'pandas.':
503+
errs.append('{} should not have prefix `pandas`'.format(rel_name))
503504
for line in doc.raw_doc.splitlines():
504505
if re.match("^ *\t", line):
505506
errs.append('Tabs found at the start of line "{}", '

0 commit comments

Comments
 (0)