diff options
Diffstat (limited to 'tests/basics/getitem.py')
-rw-r--r-- | tests/basics/getitem.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/basics/getitem.py b/tests/basics/getitem.py index f39296aca3..3029f83035 100644 --- a/tests/basics/getitem.py +++ b/tests/basics/getitem.py @@ -20,3 +20,13 @@ try: next(it) except StopIteration: pass + +# this class raises a non-StopIteration exception on iteration +class A: + def __getitem__(self, i): + raise TypeError +try: + for i in A(): + pass +except TypeError: + print("TypeError") |