summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-28 19:30:26 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-28 19:30:26 (GMT)
commitee85339cc69af6b29a37b85a5695fb9c12f0f0a3 (patch)
tree01f7a995722d516c61b70e1578d43628ab1f2a9f /Lib/test/test_compile.py
parent44e625860bf4c24a811eb81c7953a71671c89608 (diff)
downloadcpython-ee85339cc69af6b29a37b85a5695fb9c12f0f0a3.zip
cpython-ee85339cc69af6b29a37b85a5695fb9c12f0f0a3.tar.gz
cpython-ee85339cc69af6b29a37b85a5695fb9c12f0f0a3.tar.bz2
in dict displays, evaluate the key before the value (closes #11205)
Patch partially by Steve Dougherty.
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 98a4df8..f5e4576 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -461,6 +461,17 @@ if 1:
ast.body = [_ast.BoolOp()]
self.assertRaises(TypeError, compile, ast, '<ast>', 'exec')
+ def test_dict_evaluation_order(self):
+ i = 0
+
+ def f():
+ nonlocal i
+ i += 1
+ return i
+
+ d = {f(): f(), f(): f()}
+ self.assertEqual(d, {1: 2, 3: 4})
+
@support.cpython_only
def test_same_filename_used(self):
s = """def f(): pass\ndef g(): pass"""