From 659b993f44e69c90559cad028790e0df89d48e81 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Tue, 23 Sep 2025 16:58:05 +0300 Subject: [PATCH] added generic_test for logitic funtion --- testing_project/logistic.py | 2 ++ testing_project/test_logistic.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/testing_project/logistic.py b/testing_project/logistic.py index e49d1c2..ea88271 100644 --- a/testing_project/logistic.py +++ b/testing_project/logistic.py @@ -1 +1,3 @@ # Your code goes here +def f(x, r): + return r*x*(1-x) diff --git a/testing_project/test_logistic.py b/testing_project/test_logistic.py index 100d824..9b71391 100644 --- a/testing_project/test_logistic.py +++ b/testing_project/test_logistic.py @@ -20,6 +20,19 @@ def test_f_corner_cases(): # x=0.5, r=2 => f(x, r)=0.5 +def test_generic_cased(): + + cases = [ + (0.1, 2.2, 0.198), + (0.2, 3.4, 0.544), + (0.5, 2, 0.5)] + + for x, r, expected in cases: + result = f(x, r) + assert_allclose(result, expected) + + + # Hands on 2: # parametrize the above test using @pytest.mark.parametrize