def main(): # type: () -> ExitStatus """Accept arguments from the user, compute the factorial, and display the results.""" colorama.init(autoreset=True, strip=False) args = parse_args() print('fact({}{}{}) = {}{}{}'.format(colorama.Fore.CYAN, args.n, colorama.Fore.RESET, colorama.Fore.GREEN, factorial(args.n), colorama.Fore.RESET)) return ExitStatus.success
def test_factorial(n, expected): # type: (int, int) -> None assert factorial(n) == expected
def test_invalid_factorial(n): # type: (int) -> None with pytest.raises(InvalidFactorialError): factorial(n)
def test_invalid_factorial(n: int) -> None: with pytest.raises(InvalidFactorialError): factorial(n)
def test_factorial(n: int, expected: int) -> None: assert factorial(n) == expected