about summary refs log tree commit diff
path: root/tests/unit/api/test_rqtl2.py
blob: fbd0d25f1c7337a40512466e25e72f273381f060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest
from gn3.api.rqtl2 import fibonacci

def test_fibonacci_zero():
    assert fibonacci(0) == 0

def test_fibonacci_one():
    assert fibonacci(1) == 1

def test_fibonacci_ten():
    assert fibonacci(10) == 55

def test_fibonacci_negative():
    with pytest.raises(ValueError) as excinfo:
        fibonacci(-1)
    assert "non-negative integer" in str(excinfo.value)

def test_fibonacci_non_integer():
    with pytest.raises(ValueError) as excinfo:
        fibonacci(5.5)
    assert "non-negative integer" in str(excinfo.value)

def test_fibonacci_large():
    assert fibonacci(20) == 6765

@pytest.mark.parametrize("n, expected", [
    (2, 1),
    (3, 2),
    (4, 3),
    (5, 5),
    (6, 8),
    (7, 13),
])
def test_fibonacci_multiple(n, expected):
    assert fibonacci(n) == expected