Skip to content

Commit c850227

Browse files
Add doctests to primelib.py (#10242)
* Update primelib.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0070739 commit c850227

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

maths/primelib.py

+11
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,11 @@ def fib(n):
574574
"""
575575
input: positive integer 'n'
576576
returns the n-th fibonacci term , indexing by 0
577+
578+
>>> fib(5)
579+
8
580+
>>> fib(99)
581+
354224848179261915075
577582
"""
578583

579584
# precondition
@@ -589,3 +594,9 @@ def fib(n):
589594
fib1 = tmp
590595

591596
return ans
597+
598+
599+
if __name__ == "__main__":
600+
import doctest
601+
602+
doctest.testmod()

0 commit comments

Comments
 (0)