tests: Automatically skip tests that require eval, exec or frozenset.
This commit is contained in:
parent
24c513cbc3
commit
6031957473
@ -1,5 +1,11 @@
|
|||||||
# builtin eval
|
# builtin eval
|
||||||
|
|
||||||
|
try:
|
||||||
|
eval
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
eval('1 + 2')
|
eval('1 + 2')
|
||||||
eval('1 + 2\n')
|
eval('1 + 2\n')
|
||||||
eval('1 + 2\n\n#comment\n')
|
eval('1 + 2\n\n#comment\n')
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# test if eval raises SyntaxError
|
# test if eval raises SyntaxError
|
||||||
|
|
||||||
|
try:
|
||||||
|
eval
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print(eval("[1,,]"))
|
print(eval("[1,,]"))
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
# test builtin exec
|
||||||
|
|
||||||
|
try:
|
||||||
|
exec
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
print(exec("def foo(): return 42"))
|
print(exec("def foo(): return 42"))
|
||||||
print(foo())
|
print(foo())
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# test passing a string object as the key for a keyword argument
|
# test passing a string object as the key for a keyword argument
|
||||||
|
|
||||||
|
try:
|
||||||
|
exec
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
# they key in this dict is a string object and is not interned
|
# they key in this dict is a string object and is not interned
|
||||||
args = {'thisisaverylongargumentname': 123}
|
args = {'thisisaverylongargumentname': 123}
|
||||||
|
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
# test the lexer
|
# test the lexer
|
||||||
|
|
||||||
|
try:
|
||||||
|
eval
|
||||||
|
exec
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
# __debug__ is a special symbol
|
# __debug__ is a special symbol
|
||||||
print(type(__debug__))
|
print(type(__debug__))
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# tests that differ when running under Python 3.4 vs 3.5/3.6
|
# tests that differ when running under Python 3.4 vs 3.5/3.6
|
||||||
|
|
||||||
|
try:
|
||||||
|
exec
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
# from basics/fun_kwvarargs.py
|
# from basics/fun_kwvarargs.py
|
||||||
# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
|
# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
|
||||||
def f4(*vargs, **kwargs):
|
def f4(*vargs, **kwargs):
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# test syntax errors
|
# test syntax errors
|
||||||
|
|
||||||
|
try:
|
||||||
|
exec
|
||||||
|
except NameError:
|
||||||
|
print("SKIP")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
def test_syntax(code):
|
def test_syntax(code):
|
||||||
try:
|
try:
|
||||||
exec(code)
|
exec(code)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# test that iterating doesn't use the heap
|
# test that iterating doesn't use the heap
|
||||||
try:
|
try:
|
||||||
|
frozenset
|
||||||
import array
|
import array
|
||||||
except ImportError:
|
except (NameError, ImportError):
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user