Пример #1
0
def test_fibonacci():
    assert generateFibonacci(3) == [1, 1, 2]
    assert generateFibonacci(10) == [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
    assert generateFibonacci(2) == [1, 1]
    assert generateFibonacci(1) == [1]
    with pytest.raises(TypeError):
        generateFibonacci("WrongParameterType")
    with pytest.raises(ValueError):
        generateFibonacci(0)
Пример #2
0
def test_fibonacci_2():
    assert [1, 1, 2, 3, 5, 8, 13, 21] == generateFibonacci(8)
Пример #3
0
def test_fibonacci():
    assert generateFibonacci(1) == [1]
Пример #4
0
def test_fibonacci_negative_number():
    assert generateFibonacci(-12) == []
Пример #5
0
def test_fibonacci_length():
    assert len(generateFibonacci(2)) == 2
def test_fibonacci1():
    expectedValue = 1
    length = 1
    res = generateFibonacci(length)
    assert expectedValue == res, errText.format(res, expectedValue)