From 1c9471cb0d65f2f3aa92df96053d7728fc7354b0 Mon Sep 17 00:00:00 2001 From: Md Mahiuddin Date: Wed, 1 Oct 2025 11:04:38 +0600 Subject: [PATCH 1/2] Add test for non-integer input to factorial function --- maths/test_factorial.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maths/test_factorial.py b/maths/test_factorial.py index d80d88add745..3d9164d2696d 100644 --- a/maths/test_factorial.py +++ b/maths/test_factorial.py @@ -33,5 +33,11 @@ def test_negative_number(function): function(-3) +@pytest.mark.parametrize("function", [factorial, factorial_recursive]) +def test_non_integer_input(function): + with pytest.raises(ValueError): + function(1.5) + + if __name__ == "__main__": pytest.main(["-v", __file__]) From f2acd3519c90b4bcd73f1bfd64e39511ea3ad2f3 Mon Sep 17 00:00:00 2001 From: Maxim Smolskiy Date: Mon, 20 Oct 2025 03:15:45 +0300 Subject: [PATCH 2/2] Update test_factorial.py --- maths/test_factorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/test_factorial.py b/maths/test_factorial.py index 3d9164d2696d..1795ebba194f 100644 --- a/maths/test_factorial.py +++ b/maths/test_factorial.py @@ -34,7 +34,7 @@ def test_negative_number(function): @pytest.mark.parametrize("function", [factorial, factorial_recursive]) -def test_non_integer_input(function): +def test_float_number(function): with pytest.raises(ValueError): function(1.5)