Skip to content

Commit 764e65f

Browse files
dpgeorgejepler
authored andcommitted
tests/basics: Provide .exp files for generator tests that fail PEP479.
PEP479 (see https://www.python.org/dev/peps/pep-0479/) prohibited raising StopIteration from within a generator (it is turned into a RuntimeError). This behaviour was introduced in Python 3.5 and in 3.7 was made compulsory. Until uPy implements PEP479, this patch adds .py.exp files for the relevant tests so they can be run under Python 3.7.
1 parent 8f0147c commit 764e65f

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

tests/basics/gen_yield_from.py.exp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
here1
2+
3
3+
here2
4+
[1, 2]
5+
here1
6+
None
7+
here2
8+
[1, 2]
9+
here1
10+
123
11+
here2
12+
[1, 2]
13+
444
14+
[0, 1, 2]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-1
2+
1
3+
StopIteration
4+
-1
5+
1
6+
2
7+
leaf caught GeneratorExit and swallowed it
8+
delegating caught GeneratorExit
9+
StopIteration
10+
-1
11+
1
12+
2
13+
leaf caught GeneratorExit and raised StopIteration instead
14+
delegating caught GeneratorExit
15+
StopIteration
16+
123
17+
RuntimeError
18+
0
19+
1
20+
close
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
1
2+
got ValueError from upstream!
3+
str1
4+
got TypeError from downstream!
5+
123
6+
got StopIteration from downstream!

tests/basics/generator_close.py.exp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
None
2+
StopIteration
3+
1
4+
None
5+
StopIteration
6+
[1, 2]
7+
None
8+
StopIteration
9+
None
10+
ValueError

0 commit comments

Comments
 (0)