summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-10-08 13:15:07 +0100
committerDamien George <damien.p.george@gmail.com>2015-10-08 13:15:07 +0100
commit4fb5ff86eed74e7816f4126d5220830fcbb0a393 (patch)
treee99df5138705fc53d900018308a11f68220b026b /tests
parent9f5f156b9d911b6c6282eb4cf0e4f8a9129169c5 (diff)
downloadmicropython-4fb5ff86eed74e7816f4126d5220830fcbb0a393.tar.gz
micropython-4fb5ff86eed74e7816f4126d5220830fcbb0a393.zip
tests: Add test for evaluation order of dictionary key/value pairs.
In Python 3.4 the value is evaluated before the key. In Python 3.5 it's key then value.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/python34.py3
-rw-r--r--tests/basics/python34.py.exp2
2 files changed, 5 insertions, 0 deletions
diff --git a/tests/basics/python34.py b/tests/basics/python34.py
index 2e9d468b2a..7f7a1e015e 100644
--- a/tests/basics/python34.py
+++ b/tests/basics/python34.py
@@ -9,6 +9,9 @@ def print_ret(x):
return x
f4(*print_ret(['a', 'b']), kw_arg=print_ret(None))
+# test evaluation order of dictionary key/value pair (in 3.4 it's backwards)
+{print_ret(1):print_ret(2)}
+
# from basics/syntaxerror.py
# can't have multiple * or ** (in 3.5 we can)
def test_syntax(code):
diff --git a/tests/basics/python34.py.exp b/tests/basics/python34.py.exp
index 078c3fbb71..637f77ce86 100644
--- a/tests/basics/python34.py.exp
+++ b/tests/basics/python34.py.exp
@@ -1,6 +1,8 @@
None
['a', 'b']
('a', 'b') {'kw_arg': None}
+2
+1
SyntaxError
SyntaxError
3.4