The title pretty much sums it up: I tried to use assertEqual to test a function that returns a generator object, but that results in:
AssertionError: gene
Use next()
on the generator object.
assertEqual(next(generator_object), (1, 2, ...))
assertEqual(tuple(generator_object), (1, 2, ...))
if it's an infinite generator, or you just wish to look at the first n
results for some reason, you can combint this with itertools.islice
assertEqual(tuple(islice(generator_object, n)), (1, 2, ...))