Commit c2ec2ad8 authored by Damien George's avatar Damien George
Browse files

tests: Add test where __getitem__ raises IndexError to stop iteration.

parent 6433f71e
......@@ -21,6 +21,12 @@ try:
except StopIteration:
pass
# this class raises an IndexError to stop the iteration
class A:
def __getitem__(self, i):
raise IndexError
print(list(A()))
# this class raises a non-StopIteration exception on iteration
class A:
def __getitem__(self, i):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment