Skip to content

Commit bcfff4f

Browse files
committed
tests/basics/iter1.py: Add more tests for walking a user-defined iter.
Some code in mp_iternext() was only tested by the native emitter, so the tests added here test this function using just the bytecode emitter.
1 parent f50b64c commit bcfff4f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/basics/iter1.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,12 @@ def __next__(self):
6868

6969
for i in myiter(32):
7070
print(i)
71+
72+
# repeat some of the above tests but use tuple() to walk the iterator (tests mp_iternext)
73+
print(tuple(myiter(5)))
74+
print(tuple(myiter(12)))
75+
print(tuple(myiter(32)))
76+
try:
77+
tuple(myiter(22))
78+
except TypeError:
79+
print('raised TypeError')

0 commit comments

Comments
 (0)