Created
April 22, 2018 15:13
-
-
Save okken/373fb7ca1f4e061c1effbf3a3d385c84 to your computer and use it in GitHub Desktop.
alternate test for fibonacci
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
from main import fibonacci | |
@pytest.mark.parametrize('n, expected', | |
enumerate([1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144])) | |
def test_returns_correct_fibonacci_number(n, expected): | |
assert expected == fibonacci(n) | |
def test_raise_value_error_on_negative_input(): | |
with pytest.raises(ValueError): | |
fibonacci(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment