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

pull/1444/merge
Damien George 2015-08-30 11:48:06 +01:00
rodzic 6433f71e8f
commit c2ec2ad8fb
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -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):