def test_fib_values(self): expected = { 3: 2, 4: 3, 5: 5, 8: 21, 12: 144, } for n, e in expected.items(): self.assertEqual(e, fib(n))
def test_fib(self): """ Test fibonacci """ fibonacci = [] s = fib() for _ in range(0, 11): fibonacci.append(next(s)) self.assertEqual(fibonacci, [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55])
def test_first(self): self.assertEqual(fib(1), 1)
def test0(self): self.assertIsNone(fib(0))
def test_38(self): self.assertEqual(fib(38), 39088169)
def test_third(self): self.assertEqual(fib(3), 2)
def test_fib_base_case(self): self.assertEqual(0, fib(0)) self.assertEqual(1, fib(1)) self.assertEqual(1, fib(2))
def test_fib(test_input, expected): assert fib(test_input) == expected
import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import main as pymod import csv table = [] with open('tables/test.csv') as f: #reader = csv.reader(f) #table = list(reader) for line in f: data = line.split() table.append(int(data[0])) print(table) for v in table: print(pymod.fib(v)) print(pymod.version()) img = mpimg.imread("star.jpg") imgplot = plt.imshow(img) plt.show() print("Process Terminated")
def fib_pos(): return [fib(n) for n in [3, 4, 5, 6]]
def test_fib_calc(): assert fib(9) + fib(10) == fib(11) assert fib(10) + fib(11) == fib(12) assert fib(11) + fib(12) == fib(13)