1. 学习
  2. /
  3. 课程
  4. /
  5. Introduction to Testing in Python

Connected

练习

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.

说明 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.