diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ast.py | 2 | ||||
-rw-r--r-- | Lib/test/test_scope.py | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index c64ad28..14fc010 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -160,7 +160,7 @@ exec_results = [ ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, []), [('Return', (1, 8), ('Num', (1, 15), 1))], [])]), ('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])]), ('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Num', (1, 4), 1))]), -('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Load',)), ('Add',), ('Num', (1, 5), 1))]), +('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Num', (1, 5), 1))]), ('Module', [('Print', (1, 0), ('Name', (1, 8), 'f', ('Load',)), [('Num', (1, 11), 1)], False)]), ('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [])]), ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]), diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index f37254c..239745c 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -299,6 +299,17 @@ except NameError: else: raise TestFailed +# test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation +global_x = 1 +def f(): + global_x += 1 +try: + f() +except UnboundLocalError: + pass +else: + raise TestFailed, 'scope of global_x not correctly determined' + print "14. complex definitions" def makeReturner(*lst): |