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.
Questo esercizio fa parte del corso
Introduction to Testing in Python
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
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():
____