Be a program in Python, such as fibonacci calculus:
def fibR(n):
if n==1 or n==2:
return 1
return fib(n-1)+fib(n-2)
print (fibR(5))
How to make a test class / function using pytest, for example?
Be a program in Python, such as fibonacci calculus:
def fibR(n):
if n==1 or n==2:
return 1
return fib(n-1)+fib(n-2)
print (fibR(5))
How to make a test class / function using pytest, for example?
def fibR(n):
if n==1 or n==2:
return 1
return fibR(n-1)+fibR(n-2)
In the same directory: test_fib.py:
import pytest
from fib import fibR
def test_fib_1_equals_1():
assert fibR(1) == 1
def test_fib_2_equals_1():
assert fibR(2) == 1
def test_fib_6_equals_8():
assert fibR(6) == 8
@Tagc's response to the stackoverflow English version.