Skip to content

Commit 1390273

Browse files
authored
Fix doctests in factorial_recursive function
The doctests in factorial_recursive were calling factorial() instead of factorial_recursive(). This fix ensures that the tests correctly validate the factorial_recursive function itself.
1 parent c79034c commit 1390273

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

maths/factorial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ def factorial_recursive(n: int) -> int:
4141
https://en.wikipedia.org/wiki/Factorial
4242
4343
>>> import math
44-
>>> all(factorial(i) == math.factorial(i) for i in range(20))
44+
>>> all(factorial_recursive(i) == math.factorial(i) for i in range(20))
4545
True
46-
>>> factorial(0.1)
46+
>>> factorial_recursive(0.1)
4747
Traceback (most recent call last):
4848
...
4949
ValueError: factorial() only accepts integral values
50-
>>> factorial(-1)
50+
>>> factorial_recursive(-1)
5151
Traceback (most recent call last):
5252
...
5353
ValueError: factorial() not defined for negative values

0 commit comments

Comments
 (0)