1# tests that differ when running under Python 3.4 vs 3.5/3.6/3.7
2
3try:
4    exec
5except NameError:
6    print("SKIP")
7    raise SystemExit
8
9# from basics/fun_kwvarargs.py
10# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
11def f4(*vargs, **kwargs):
12    print(vargs, kwargs)
13def print_ret(x):
14    print(x)
15    return x
16f4(*print_ret(['a', 'b']), kw_arg=print_ret(None))
17
18# test evaluation order of dictionary key/value pair (in 3.4 it's backwards)
19{print_ret(1):print_ret(2)}
20
21# from basics/syntaxerror.py
22def test_syntax(code):
23    try:
24        exec(code)
25    except SyntaxError:
26        print("SyntaxError")
27test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can)
28test_syntax("f(**a, **b)") # can't have multiple ** (in 3.5 we can)
29test_syntax("f(*a, b)") # can't have positional after *
30test_syntax("f(**a, b)") # can't have positional after **
31test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can)
32test_syntax("del ()") # can't delete empty tuple (in 3.6 we can)
33
34# from basics/sys1.py
35# uPy prints version 3.4
36import usys
37print(usys.version[:3])
38print(usys.version_info[0], usys.version_info[1])
39
40# from basics/exception1.py
41# in 3.7 no comma is printed if there is only 1 arg (in 3.4-3.6 one is printed)
42print(repr(IndexError("foo")))
43