Skip to content

Commit 1ae906a

Browse files
Shivanggaryaapre-commit-ci[bot]MaximSmolskiy
authored
Fix incorrect doctest references in fibonacci functions (#14200)
* Fix incorrect doctest references in fibonacci functions * [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> Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
1 parent f5c3e7c commit 1ae906a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

maths/fibonacci.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ def fib_iterative(n: int) -> list[int]:
9191
def fib_recursive(n: int) -> list[int]:
9292
"""
9393
Calculates the first n (0-indexed) Fibonacci numbers using recursion
94-
>>> fib_iterative(0)
94+
>>> fib_recursive(0)
9595
[0]
96-
>>> fib_iterative(1)
96+
>>> fib_recursive(1)
9797
[0, 1]
98-
>>> fib_iterative(5)
98+
>>> fib_recursive(5)
9999
[0, 1, 1, 2, 3, 5]
100-
>>> fib_iterative(10)
100+
>>> fib_recursive(10)
101101
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
102-
>>> fib_iterative(-1)
102+
>>> fib_recursive(-1)
103103
Traceback (most recent call last):
104104
...
105105
ValueError: n is negative
@@ -119,7 +119,7 @@ def fib_recursive_term(i: int) -> int:
119119
>>> fib_recursive_term(-1)
120120
Traceback (most recent call last):
121121
...
122-
Exception: n is negative
122+
ValueError: n is negative
123123
"""
124124
if i < 0:
125125
raise ValueError("n is negative")
@@ -135,15 +135,15 @@ def fib_recursive_term(i: int) -> int:
135135
def fib_recursive_cached(n: int) -> list[int]:
136136
"""
137137
Calculates the first n (0-indexed) Fibonacci numbers using recursion
138-
>>> fib_iterative(0)
138+
>>> fib_recursive_cached(0)
139139
[0]
140-
>>> fib_iterative(1)
140+
>>> fib_recursive_cached(1)
141141
[0, 1]
142-
>>> fib_iterative(5)
142+
>>> fib_recursive_cached(5)
143143
[0, 1, 1, 2, 3, 5]
144-
>>> fib_iterative(10)
144+
>>> fib_recursive_cached(10)
145145
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
146-
>>> fib_iterative(-1)
146+
>>> fib_recursive_cached(-1)
147147
Traceback (most recent call last):
148148
...
149149
ValueError: n is negative
@@ -176,7 +176,7 @@ def fib_memoization(n: int) -> list[int]:
176176
[0, 1, 1, 2, 3, 5]
177177
>>> fib_memoization(10)
178178
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
179-
>>> fib_iterative(-1)
179+
>>> fib_memoization(-1)
180180
Traceback (most recent call last):
181181
...
182182
ValueError: n is negative

0 commit comments

Comments
 (0)