add generic test for logistics function fix2 #15
1 changed files with 5 additions and 9 deletions
|
@ -1,17 +1,13 @@
|
||||||
from numpy.testing import assert_allclose
|
from numpy.testing import assert_allclose
|
||||||
|
import pytest
|
||||||
from logistic import f
|
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)
|
# Test cases are (x, r, expected)
|
||||||
cases = [
|
result = f(x, r)
|
||||||
(0, 1.1, 0),
|
assert_allclose(result, expected)
|
||||||
(1, 3.7, 0),
|
|
||||||
]
|
|
||||||
for x, r, expected in cases:
|
|
||||||
result = f(x, r)
|
|
||||||
assert_allclose(result, expected)
|
|
||||||
|
|
||||||
# Hands on 1
|
# Hands on 1
|
||||||
#Add a new test for these generic cases using the for-loop pattern:
|
#Add a new test for these generic cases using the for-loop pattern:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue