Factorial of number
You will implement pytest tests using the provided test cases to test the factorial function. The factorial function of n is the product of all positive integers less than or equal to n. It is guaranteed that n is a non-negative integer. At each step, you will get a test case that you need to implement in Python. The pytest library was already imported for you.
Deze oefening maakt deel uit van de cursus
Introduction to Testing in Python
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
def factorial(n):
if n == 0: return 1
elif (type(n) == int):
return n * factorial(n-1)
else: return -1
# Test case: expected input
def test_regular():
____