2018-08-17 01:46:04 -04:00
|
|
|
# tests that differ when running under Python 3.4 vs 3.5/3.6/3.7
|
2015-10-02 08:01:47 -04:00
|
|
|
|
2018-02-14 00:46:44 -05:00
|
|
|
try:
|
|
|
|
exec
|
|
|
|
except NameError:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
|
|
|
|
2020-03-25 00:54:45 -04:00
|
|
|
|
2015-10-02 08:01:47 -04:00
|
|
|
def print_ret(x):
|
|
|
|
print(x)
|
|
|
|
return x
|
|
|
|
|
2015-10-08 08:15:07 -04:00
|
|
|
# test evaluation order of dictionary key/value pair (in 3.4 it's backwards)
|
|
|
|
{print_ret(1):print_ret(2)}
|
|
|
|
|
2020-03-25 00:54:45 -04:00
|
|
|
|
2015-10-02 08:01:47 -04:00
|
|
|
# from basics/syntaxerror.py
|
|
|
|
def test_syntax(code):
|
|
|
|
try:
|
|
|
|
exec(code)
|
|
|
|
except SyntaxError:
|
|
|
|
print("SyntaxError")
|
2020-03-25 00:54:45 -04:00
|
|
|
|
|
|
|
|
2017-06-14 04:18:01 -04:00
|
|
|
test_syntax("f(**a, b)") # can't have positional after **
|
2017-01-08 08:19:01 -05:00
|
|
|
test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can)
|
|
|
|
test_syntax("del ()") # can't delete empty tuple (in 3.6 we can)
|
2015-10-02 08:01:47 -04:00
|
|
|
|
|
|
|
# from basics/sys1.py
|
|
|
|
# uPy prints version 3.4
|
2020-06-18 05:19:14 -04:00
|
|
|
import usys
|
|
|
|
print(usys.version[:3])
|
|
|
|
print(usys.version_info[0], usys.version_info[1])
|
2018-08-17 01:46:04 -04:00
|
|
|
|
|
|
|
# from basics/exception1.py
|
|
|
|
# in 3.7 no comma is printed if there is only 1 arg (in 3.4-3.6 one is printed)
|
|
|
|
print(repr(IndexError("foo")))
|