From 0d4887abe6d6fe77ffdaae9dc669cf865778adfe Mon Sep 17 00:00:00 2001 From: Adam Kelly Date: Mon, 4 Mar 2019 14:22:48 +0000 Subject: [PATCH] Fix missing asserts and add (disabled) tests for things that don't work yet. --- tests/snippets/test_exec.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/snippets/test_exec.py b/tests/snippets/test_exec.py index 852ef6143..37ba33ff1 100644 --- a/tests/snippets/test_exec.py +++ b/tests/snippets/test_exec.py @@ -11,7 +11,28 @@ exec("assert 4 == x", {'x': 2}, {'x': 4}) exec("assert max(1, 2) == 2", {}, {}) -exec("max(1, 5, square(5)) == 25", None) +exec("assert max(1, 5, square(5)) == 25", None) + +# +# These doesn't work yet: +# +# Local environment shouldn't replace global environment: +# +# exec("assert max(1, 5, square(5)) == 25", None, {}) +# +# Closures aren't available if local scope is replaced: +# +# def g(): +# seven = "seven" +# def f(): +# try: +# exec("seven", None, {}) +# except NameError: +# pass +# else: +# raise NameError("seven shouldn't be in scope") +# f() +# g() try: exec("", 1)