diff --git a/tests/basics/getitem.py b/tests/basics/getitem.py index 3029f83035..4944641d15 100644 --- a/tests/basics/getitem.py +++ b/tests/basics/getitem.py @@ -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):