diff options
Diffstat (limited to 'Lib/test/test_compiler.py')
| -rw-r--r-- | Lib/test/test_compiler.py | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py index 929a12b..9dff71e 100644 --- a/Lib/test/test_compiler.py +++ b/Lib/test/test_compiler.py @@ -104,6 +104,19 @@ class CompilerTest(unittest.TestCase):          self.assertEquals(flatten([1, [2]]), [1, 2])          self.assertEquals(flatten((1, (2,))), [1, 2]) +    def testNestedScope(self): +        c = compiler.compile('def g():\n' +                             '    a = 1\n' +                             '    def f(): return a + 2\n' +                             '    return f()\n' +                             'result = g()', +                             '<string>', +                             'exec') +        dct = {} +        exec c in dct +        self.assertEquals(dct.get('result'), 3) + +          NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard)  ###############################################################################  | 
