tests: Add test for compile builtin.
This commit is contained in:
parent
c9fc620723
commit
627852019b
21
tests/basics/builtin_compile.py
Normal file
21
tests/basics/builtin_compile.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# test compile builtin
|
||||||
|
|
||||||
|
try:
|
||||||
|
compile
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
import sys
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
c = compile("print(x)", "file", "exec")
|
||||||
|
|
||||||
|
try:
|
||||||
|
exec(c)
|
||||||
|
except NameError:
|
||||||
|
print("NameError")
|
||||||
|
|
||||||
|
x = 1
|
||||||
|
exec(c)
|
||||||
|
|
||||||
|
exec(c, {"x":2})
|
||||||
|
exec(c, {}, {"x":3})
|
Loading…
x
Reference in New Issue
Block a user