summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/getitem.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/getitem.py')
-rw-r--r--tests/basics/getitem.py6
1 files changed, 6 insertions, 0 deletions
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):