Skip to content

Commit cb9b9e6

Browse files
committed
Add tests for locals
1 parent 43a7245 commit cb9b9e6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/snippets/global_nonlocal.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,27 @@ def f():
8585
# nonlocal c
8686
# c = 2
8787

88+
def a():
89+
x = 0
90+
locals()['x'] = 3
91+
assert x == 0
92+
93+
a()
94+
95+
def a():
96+
x = 0
97+
del locals()['x']
98+
assert x == 0
99+
100+
a()
101+
102+
def a():
103+
x = 0
104+
b = locals()
105+
assert b['x'] == 0
106+
107+
del b['x']
108+
b = locals()
109+
assert b['x'] == 0
110+
111+
a()

0 commit comments

Comments
 (0)