Пример #1
0
def test_fib():
    '''
    Tests the Fibonacci Numbers function
    '''
    x = fib()
    for i in range(10):
        y = next(x)
    assert y == 34

    a = fib()
    for i in range(1):
        z = next(a)
    assert z == 0

    b = fib()
    for i in range(4):
        c = next(b)
        print(c)
    assert c == 2
 def test_fib(self):
     gen = g.fib()
     seq = [1, 1, 2, 3, 5, 8, 13, 21, 34]
     for s in seq:
         self.assertEqual(next(gen), s)
 def test_fib_generation(self):
     fib = generators.fib()
     first_fibs = [fib.next() for i in range(3)]
     self.assertSequenceEqual(first_fibs, [0,1,1])
def test_fib():
    g = gen.fib()
    assert [next(g) for i in range(9)] == [1, 1, 2, 3, 5, 8, 13, 21, 34]
Пример #5
0
def test_fib():
    g = gs.fib()
    for val in [1, 1, 2, 3, 5, 8, 13, 21, 34]:
        assert next(g) == val