use decorator to parametrize

This commit is contained in:
ASPP Student 2025-09-23 17:54:21 +03:00
parent 5ec2909b26
commit c11156fb80

View file

@ -1,17 +1,13 @@
from numpy.testing import assert_allclose
import pytest
from logistic import f
def test_f_corner_cases():
@pytest.mark.parametrize('x,r,expected', [(0, 1.1, 0),(1, 3.7, 0)])
def test_f_corner_cases(x, r, expected):
# Test cases are (x, r, expected)
cases = [
(0, 1.1, 0),
(1, 3.7, 0),
]
for x, r, expected in cases:
result = f(x, r)
assert_allclose(result, expected)
result = f(x, r)
assert_allclose(result, expected)
# Hands on 1
#Add a new test for these generic cases using the for-loop pattern: