Skip to content

Commit e2a78d4

Browse files
Add test for non-integer input to factorial function (TheAlgorithms#13024)
* Add test for non-integer input to factorial function * Update test_factorial.py --------- Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
1 parent 1b0bd16 commit e2a78d4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

maths/test_factorial.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,11 @@ def test_negative_number(function):
3333
function(-3)
3434

3535

36+
@pytest.mark.parametrize("function", [factorial, factorial_recursive])
37+
def test_float_number(function):
38+
with pytest.raises(ValueError):
39+
function(1.5)
40+
41+
3642
if __name__ == "__main__":
3743
pytest.main(["-v", __file__])

0 commit comments

Comments
 (0)