Skip to content
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

Added missing-raises-doc message example #6341

Merged
merged 3 commits into from
Apr 19, 2022
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
8 changes: 8 additions & 0 deletions doc/data/messages/m/missing-raises-doc/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def integer_sum(a: int, b: int): # [missing-raises-doc]
"""Returns sum of two integers
:param a: first integer
:param b: second integer
"""
if not (isinstance(a, int) and isinstance(b, int)):
raise ValueError('Function supports only integer parameters.')
return a + b
9 changes: 9 additions & 0 deletions doc/data/messages/m/missing-raises-doc/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def integer_sum(a: int, b: int):
"""Returns sum of two integers
:param a: first integer
:param b: second integer
:raises ValueError: One of the parameters is not an integer.
"""
if not (isinstance(a, int) and isinstance(b, int)):
raise ValueError('Function supports only integer parameters.')
return a + b