test for the logistic function (generic cases)
This commit is contained in:
parent
c14f7b84d5
commit
9c3284cb98
1 changed files with 9 additions and 6 deletions
|
@ -13,12 +13,15 @@ def test_f_corner_cases():
|
||||||
result = f(x, r)
|
result = f(x, r)
|
||||||
assert_allclose(result, expected)
|
assert_allclose(result, expected)
|
||||||
|
|
||||||
# Hands on 1
|
def test_f_generic_cases():
|
||||||
#Add a new test for these generic cases using the for-loop pattern:
|
cases = [
|
||||||
# x=0.1, r=2.2 => f(x, r)=0.198
|
(0.1, 2.2, 0.198),
|
||||||
# x=0.2, r=3.4 => f(x, r)=0.544
|
(0.2, 3.4, 0.544),
|
||||||
# x=0.5, r=2 => f(x, r)=0.5
|
(0.5, 2, 0.5)
|
||||||
|
]
|
||||||
|
for x, r, expected in cases:
|
||||||
|
result = f(x, r)
|
||||||
|
assert_allclose(result, expected)
|
||||||
|
|
||||||
# Hands on 2:
|
# Hands on 2:
|
||||||
# parametrize the above test using @pytest.mark.parametrize
|
# parametrize the above test using @pytest.mark.parametrize
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue