1. Učit se
  2. /
  3. Kurzy
  4. /
  5. Introduction to Testing in Python

Connected

cvičení

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.

Instrukce 1/3

undefined XP
  • 1
    • Implement one test to check that for the input 5, the function returns 120.
  • 2
    • Implement a test to check that for the zero input 0, the function returns 1.
  • 3
    • Implement a test to check that for the string input '5', the function returns -1.