Skip to content

Commit 4fb5ff8

Browse files
committed
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.
1 parent 9f5f156 commit 4fb5ff8

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

tests/basics/python34.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ def print_ret(x):
99
return x
1010
f4(*print_ret(['a', 'b']), kw_arg=print_ret(None))
1111

12+
# test evaluation order of dictionary key/value pair (in 3.4 it's backwards)
13+
{print_ret(1):print_ret(2)}
14+
1215
# from basics/syntaxerror.py
1316
# can't have multiple * or ** (in 3.5 we can)
1417
def test_syntax(code):

tests/basics/python34.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
None
22
['a', 'b']
33
('a', 'b') {'kw_arg': None}
4+
2
5+
1
46
SyntaxError
57
SyntaxError
68
3.4

0 commit comments

Comments
 (0)