From 9fe40f3aa719ee6928a587ba31374ccf8e2a2533 Mon Sep 17 00:00:00 2001 From: rtang09 <49603415+rtang09@users.noreply.github.com> Date: Mon, 9 Oct 2023 23:32:33 -0700 Subject: [PATCH 1/2] Update primelib.py --- maths/primelib.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/maths/primelib.py b/maths/primelib.py index cf01750cf912..9606592b192b 100644 --- a/maths/primelib.py +++ b/maths/primelib.py @@ -46,6 +46,15 @@ def is_prime(number: int) -> bool: """ input: positive integer 'number' returns true if 'number' is prime otherwise false. + + >>> is_prime(97) + True + >>> is_prime(9991) + False + >>> is_prime(-3) + Traceback (most recent call last): + ... + AssertionError: 'number' must been an int and positive """ # precondition @@ -589,3 +598,7 @@ def fib(n): fib1 = tmp return ans + +if __name__ == "__main__": + import doctest + doctest.testmod() From d0bc97f0ff89fab26a4bf26dc3e4a5b5d6e0de9a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 06:35:56 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/primelib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maths/primelib.py b/maths/primelib.py index 9606592b192b..88e1f743850e 100644 --- a/maths/primelib.py +++ b/maths/primelib.py @@ -599,6 +599,8 @@ def fib(n): return ans + if __name__ == "__main__": import doctest + doctest.testmod()