Pytest testing Fibonacci
We already know how to write a test checking the regular result.
from fibonacci import fib
def test_fib():
assert fib(10) == 55
Output:
============================= test session starts ==============================
platform linux -- Python 3.8.6, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/gabor/work/slides/python/examples/pytest/fib1
plugins: flake8-1.0.6, dash-1.17.0
collected 1 item
test_fibonacci.py . [100%]
============================== 1 passed in 0.00s ===============================