From 80ddc282b2ee0b570148099226513f6f05783393 Mon Sep 17 00:00:00 2001 From: Matus Valo Date: Tue, 19 Apr 2022 23:10:40 +0200 Subject: [PATCH] Added missing-raises-doc message example (#6341) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> --- doc/data/messages/m/missing-raises-doc/bad.py | 8 ++++++++ doc/data/messages/m/missing-raises-doc/good.py | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 doc/data/messages/m/missing-raises-doc/bad.py create mode 100644 doc/data/messages/m/missing-raises-doc/good.py diff --git a/doc/data/messages/m/missing-raises-doc/bad.py b/doc/data/messages/m/missing-raises-doc/bad.py new file mode 100644 index 0000000000..9a59fea88b --- /dev/null +++ b/doc/data/messages/m/missing-raises-doc/bad.py @@ -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 diff --git a/doc/data/messages/m/missing-raises-doc/good.py b/doc/data/messages/m/missing-raises-doc/good.py new file mode 100644 index 0000000000..c274493ea6 --- /dev/null +++ b/doc/data/messages/m/missing-raises-doc/good.py @@ -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