mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
py: Simplify and remove redundant code for __iter__ method lookup.
This commit is contained in:
6
tests/basics/iter0.py
Normal file
6
tests/basics/iter0.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# builtin type that is not iterable
|
||||
try:
|
||||
for i in 1:
|
||||
pass
|
||||
except TypeError:
|
||||
print('TypeError')
|
||||
@@ -1,5 +1,14 @@
|
||||
# test user defined iterators
|
||||
|
||||
# this class is not iterable
|
||||
class NotIterable:
|
||||
pass
|
||||
try:
|
||||
for i in NotIterable():
|
||||
pass
|
||||
except TypeError:
|
||||
print('TypeError')
|
||||
|
||||
class MyStopIteration(StopIteration):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user