If there are no DOCs provided at all, don't traceback, skip the _ensure_imports_below_docs test (#25621)

pull/4420/head
Matt Martz 2017-06-12 16:47:06 -05:00 committed by GitHub
parent 025b52938e
commit cb704a4310
1 changed files with 8 additions and 3 deletions

View File

@ -542,9 +542,14 @@ class ModuleValidator(Validator):
)
def _ensure_imports_below_docs(self, doc_info, first_callable):
try:
min_doc_line = min(
[doc_info[key]['lineno'] for key in doc_info if doc_info[key]['lineno']]
)
except ValueError:
# We can't perform this validation, as there are no DOCs provided at all
return
max_doc_line = max(
[doc_info[key]['end_lineno'] for key in doc_info if doc_info[key]['end_lineno']]
)