mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
26 lines
230 B
Python
26 lines
230 B
Python
|
|
||
|
|
||
|
def bar():
|
||
|
# local scope
|
||
|
local = 5
|
||
|
assert eval('local') == 5
|
||
|
|
||
|
|
||
|
bar()
|
||
|
|
||
|
assert eval('1+1') == 2
|
||
|
|
||
|
|
||
|
def foo():
|
||
|
return 3
|
||
|
|
||
|
|
||
|
# global scope
|
||
|
assert eval('foo()') == 3
|
||
|
|
||
|
g_val = 4
|
||
|
assert eval('g_val') == 4
|
||
|
|
||
|
|
||
|
print('PASS')
|