File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 1
- import unittest
2
- from recursion .factorial import factorial
1
+ import pytest
3
2
3
+ from recursion .factorial import factorial
4
4
5
- class TestFactorial (unittest .TestCase ):
6
- def test_factorial_valid_inputs (self ):
7
- self .assertEqual (factorial (0 ), 1 )
8
- self .assertEqual (factorial (1 ), 1 )
9
- self .assertEqual (factorial (5 ), 120 )
10
- self .assertEqual (factorial (10 ), 3628800 )
11
5
12
- def test_factorial_invalid_input (self ):
13
- with self .assertRaises (ValueError ):
14
- factorial (- 1 )
6
+ def test_factorial_valid_inputs () -> None :
7
+ assert factorial (0 ) == 1
8
+ assert factorial (1 ) == 1
9
+ assert factorial (5 ) == 120
10
+ assert factorial (10 ) == 3628800
15
11
16
12
17
- if __name__ == "__main__" :
18
- unittest .main ()
13
+ def test_factorial_invalid_input () -> None :
14
+ with pytest .raises (ValueError ):
15
+ factorial (- 1 )
You can’t perform that action at this time.
0 commit comments