def function_should_return_a_generator(self): expect(type(fibonacci_sequence(1))).to.equal(GeneratorType)
def shouldnt_allow(self, limit_type): gen = fibonacci_sequence(limit_type) expect(next, [gen]).to.raise_a(TypeError)
def shouldnt_allow_a_limit_less_than_one(self): gen = fibonacci_sequence(0) expect(next, [gen]).to.raise_a(ValueError)
def shouldnt_allow_negative_numbers(self): gen = fibonacci_sequence(-1) expect(next, [gen]).to.raise_a(ValueError)
def can_generate_the(self, limit, value): sequence = [num for num in fibonacci_sequence(limit)] expect(len(sequence)).to.equal(limit) expect(sequence[-1]).to.equal(value)