def test_fib(self): ''' Test the outputs of the fibonnaci function ''' assert fibonacci(-1) is None assert fibonacci(0) == 0 assert fibonacci(1) == 1 assert fibonacci(5) == 5 assert fibonacci(10) == 55
def test_sum_series(): """Verify some simple behaviors of s.sum_series(...)""" for i in range(25): assert s.sum_series(0, i, i + 1) == i assert s.sum_series(1, i + 1000, i) == i assert s.sum_series(i, 1, 1) == s.fibonacci(i + 1) assert s.sum_series(i, 3, 4) == s.lucas(i + 2)
def test_fibonacci(): assert (series.fibonacci(0) == 0) assert (series.fibonacci(1) == 1) assert (series.fibonacci(2) == 1) assert (series.fibonacci(3) == 2) assert (series.fibonacci(4) == 3) assert (series.fibonacci(5) == 5) assert (series.fibonacci(6) == 8) assert (series.fibonacci(7) == 13)
def test_fibonacci(): assert(series.fibonacci(0) == 0) assert(series.fibonacci(1) == 1) assert(series.fibonacci(2) == 1) assert(series.fibonacci(3) == 2) assert(series.fibonacci(4) == 3) assert(series.fibonacci(5) == 5) assert(series.fibonacci(6) == 8) assert(series.fibonacci(7) == 13)
def test_fibo_and_sumseries(): # Fibonacci list of paired inputs and expected outputs. fiboInOut = [(0, 0), (1, 1), (2, 1), (3, 2), (4, 3), (5, 5), (6, 8), (7, 13), (8, 21), (9, 34), (10, 55)] # Checking actual results with expected results from fiboInOut list for n, result in fiboInOut: assert fibonacci(n) == result assert sum_series(n) == result
def test_fibs(): """Test first several values of the s.fibonacci sequence""" assert s.fibonacci(0) == 0 assert s.fibonacci(1) == 1 assert s.fibonacci(2) == 1 assert s.fibonacci(3) == 2 assert s.fibonacci(4) == 3 assert s.fibonacci(5) == 5 assert s.fibonacci(6) == 8 assert s.fibonacci(7) == 13
def test_fibonacci(): u""" Ensure the first 12 values returned by fibonacci() equal a known source. Also ensures the first 12 values returned by sum_series() with the default arguments matches the output. """ for input_, output in fibonacci_vals: assert series.fibonacci(input_) == output assert series.sum_series(input_) == output
def test_fibonacci(): # 1 point for passing the four tests below assert(series.fibonacci(0) == 0) assert(series.fibonacci(1) == 1) assert(series.fibonacci(2) == 1) assert(series.fibonacci(3) == 2) # 1 point for passing the four tests below assert(series.fibonacci(4) == 3) assert(series.fibonacci(5) == 5) assert(series.fibonacci(6) == 8) assert(series.fibonacci(7) == 13)
def test_bad_inputs(): u""" Verify that fibonacci(), lucas(), and sum_series() catch all inputs that are not non-negative integers. """ for badval in [3.14, 'a', []]: with pytest.raises(ValueError): fibonacci_result = series.fibonacci(badval) lucas_result = series.lucas(badval) sum_series_result = series.sum_series(badval)
def test_fib_three(): expected = 1 actual = fibonacci(3) assert actual == expected
import GridPrinter import FizzBuzz import series GridPrinter.mmatrix(3, 3) FizzBuzz.fizzBuzz() r = series.fibonacci(3) print(r)
def test_sum_series(): for i in range(7): assert sum_series(i) == fibonacci(i) assert sum_series(i, 2, 1) == lucas(i)
def test_third_index(): actual = fibonacci(3) expected = 1 assert expected == actual
def test_fibonacci(): assert(series.fibonacci(0) == 0) assert(series.fibonacci(1) == 1) assert(series.fibonacci(9) == 34)
def test_fibonacci(self): assert fibonacci(0) == 0 assert fibonacci(1) == 1 assert fibonacci(10) == 55
def test_fib(): # Check fibonacci sequence values are as expected for i in range(1, len(fib_values)+1): assert fib_values[i-1] == fibonacci(i)
def test_fib(): assert fibonacci(3) == 2 assert fibonacci(4) == 3 assert fibonacci(5) == 5
def test_fibonacci(): assert(series.fibonacci(1) == 1) assert(series.fibonacci(5) == 5) assert(series.fibonacci(7) == 13)
def test_fibonacci(n, result): """Assert nth number in fibonacci series.""" from series import fibonacci assert fibonacci(n) == result
def prob_002(): return sum(b for b in series.fibonacci(1, 2, 4000000) if b % 2 == 0)
def prob_025(): for b, i in zip(series.fibonacci(1, 1), count(2)): if len(str(b)) > 999: return i
def test_fib_five(): expected = 144 actual = fibonacci(13) assert actual == expected
def test_neg(): # Check functions with negative n values. assert sum_series(-1, 2, 1) is None assert fibonacci(-4) is None assert lucas(0) is None
def test_fib_one(): expected = 0 actual = fibonacci(1) assert actual == expected
def test_sum_series_is_fib(): """Verify that s.sum_series(n) without optional arguments is s.fibonacci(n)""" for i in range(25): assert s.sum_series(i) == s.fibonacci(i)
def test_fibo_2(): from series import fibonacci assert fibonacci(2) == 1
def test_fifth_index(): actual = fibonacci(5) expected = 3 assert expected == actual
def test_fibonacci(): assert s.fibonacci(5) == 5 assert s.fibonacci(10) == 55
def test_fibonacci(n, c): from series import fibonacci assert fibonacci(n) == c
def test_fibonacci(n, result): from series import fibonacci assert fibonacci(n) == result
def test_sum_series(): assert s.fibonacci(5) == s.sum_series(5) assert s.lucas(5) == s.sum_series(5, 2, 1)
def test_sixth_index(): actual = fibonacci(6) expected = 5 assert expected == actual
def test_fibbonacci(n, result): """Test fibonacci function against defined FIBB_TABLE above.""" from series import fibonacci assert fibonacci(n) == result
def test_fourth_index(): actual = fibonacci(4) expected = 2 assert expected == actual
def test_fibonacci(n, result): """Test for numbers in the Fibonacci Sequence.""" from series import fibonacci assert fibonacci(n) == result
def test_fibonacci(): assert fibonacci(0) == 0 assert fibonacci(1) == 1 for i in range(2, 30): assert fibonacci(i) == fibonacci(i - 2) + fibonacci(i - 1)
def test_fib_n_at_4(): actual = fibonacci(4) expected = 2 assert actual == expected
def test_fib_two(): expected = 1 actual = fibonacci(2) assert actual == expected
def test_fib_n_at_1(): actual = fibonacci(1) expected = 0 assert actual == expected
def test_fib_four(): expected = 8 actual = fibonacci(7) assert actual == expected
from series import fibonacci from itertools import ifilter even = ifilter(lambda f: f % 2 == 0, fibonacci()) for e in even: print(e) if e > 200: break
def test_fib_six(): with pytest.raises(ValueError) as context: fibonacci(-2) assert str(context.value) == 'numbers smaller than zero can not be used'
def test_fibo_25(): from series import fibonacci assert fibonacci(25) == 46368
def test_fib_seven(): expected = 308061521170129 actual = fibonacci(72) assert actual == expected
def test_fibonacci(): # fibonacci assert fibonacci(0) == 0 assert fibonacci(5) == 5 assert sum_series(0) == 0
def test_entry_validity(n): """Test for invalid entries.""" from series import fibonacci, lucas, sum_series assert fibonacci(n) == 'Only integers above zero are valid!' assert lucas(n) == 'Only integers above zero are valid!' assert sum_series(n) == 'Only integers above zero are valid!'
def test_fibonacci(n, result): """Test fibonacci function.""" from series import fibonacci assert fibonacci(n) == result
def test_fib_n_at_8(): actual = fibonacci(8) expected = 13 assert actual == expected
def test_letter(): expected = "Input should be a one integer" actual = fibonacci("a") assert actual == expected
def test_fib_n_at_2(): actual = fibonacci(2) expected = 1 assert actual == expected
def test_float(): expected = "Input should be a one integer" actual = fibonacci(1.354) assert actual == expected
def test_fibo_3(): from series import fibonacci assert fibonacci(3) == 1
def test_zero(): expected = 0 actual = fibonacci(0) assert actual == expected
def test_fibo_1(): from series import fibonacci assert fibonacci(1) == 0
def test_fib(n, result): import series assert series.fibonacci(n) == result
def test_fibonacci(n, result): """Test fibonacci method.""" from series import fibonacci assert fibonacci(n) == result
def test_fibonacci(n, result): """Test function `fibonacci' outputs correct values for the Fibonacci sequence.""" from series import fibonacci assert fibonacci(n) == result