summaryrefslogtreecommitdiff
path: root/tests/basics/iter1.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-03-30 14:21:18 +1100
committerDamien George <damien.p.george@gmail.com>2018-03-30 14:23:13 +1100
commitbcfff4fc98a73c5ad9b7d3e338649955e861ada4 (patch)
treed8300d14590719b84880291596feda6a4a4d3c04 /tests/basics/iter1.py
parentf50b64cab58025e080f994147b75a8ffc55d2b35 (diff)
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.
Diffstat (limited to 'tests/basics/iter1.py')
-rw-r--r--tests/basics/iter1.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/basics/iter1.py b/tests/basics/iter1.py
index 9117dfd2b..26e9a2ef2 100644
--- a/tests/basics/iter1.py
+++ b/tests/basics/iter1.py
@@ -68,3 +68,12 @@ except StopIteration:
for i in myiter(32):
print(i)
+
+# repeat some of the above tests but use tuple() to walk the iterator (tests mp_iternext)
+print(tuple(myiter(5)))
+print(tuple(myiter(12)))
+print(tuple(myiter(32)))
+try:
+ tuple(myiter(22))
+except TypeError:
+ print('raised TypeError')