Added test for code which raises StopIteration