Skip to content

Commit

Permalink
Added missing-raises-doc message example (#6341)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
  • Loading branch information
matusvalo and DanielNoord committed Apr 19, 2022
1 parent 7defcbd commit 80ddc28
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit 80ddc28

Please sign in to comment.