Skip to content

Commit 65cadbe

Browse files
committed
tests: Update test suite to be compatible with CPython 3.6.
CPython 3.6 has a few changes that, when run on uPy's test suite, give a different output to CPython 3.5. uPy currently officially supports the 3.4 language definition, but it's useful to be able to run the test suite with 3.4/3.5/3.6 versions of CPython. This patch makes such changes to support 3.6.
1 parent 5653e3c commit 65cadbe

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

tests/basics/python34.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# tests that differ when running under Python 3.4 vs 3.5
1+
# tests that differ when running under Python 3.4 vs 3.5/3.6
22

33
# from basics/fun_kwvarargs.py
44
# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
@@ -13,14 +13,15 @@ def print_ret(x):
1313
{print_ret(1):print_ret(2)}
1414

1515
# from basics/syntaxerror.py
16-
# can't have multiple * or ** (in 3.5 we can)
1716
def test_syntax(code):
1817
try:
1918
exec(code)
2019
except SyntaxError:
2120
print("SyntaxError")
22-
test_syntax("f(*a, *b)")
23-
test_syntax("f(**a, **b)")
21+
test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can)
22+
test_syntax("f(**a, **b)") # can't have multiple ** (in 3.5 we can)
23+
test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can)
24+
test_syntax("del ()") # can't delete empty tuple (in 3.6 we can)
2425

2526
# from basics/sys1.py
2627
# uPy prints version 3.4

tests/basics/python34.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ None
55
1
66
SyntaxError
77
SyntaxError
8+
SyntaxError
9+
SyntaxError
810
3.4
911
3 4

tests/basics/syntaxerror.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ def test_syntax(code):
4646
# can't assign to power of composite
4747
test_syntax("f[0]**2 = 1")
4848

49-
# can't assign to empty tuple
50-
test_syntax("() = 1")
51-
5249
# can't have *x on RHS
5350
test_syntax("x = *x")
5451

@@ -66,7 +63,6 @@ def test_syntax(code):
6663
test_syntax("def f(a=1, b): pass")
6764

6865
# can't delete these things
69-
test_syntax("del ()")
7066
test_syntax("del f()")
7167
test_syntax("del f[0]**2")
7268
test_syntax("del (a for a in a)")

0 commit comments

Comments
 (0)