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
|
||||
|
||||
try:
|
||||
eval
|
||||
except NameError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
eval('1 + 2')
|
||||
eval('1 + 2\n')
|
||||
eval('1 + 2\n\n#comment\n')
|
||||
|
@ -1,5 +1,11 @@
|
||||
# test if eval raises SyntaxError
|
||||
|
||||
try:
|
||||
eval
|
||||
except NameError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
try:
|
||||
print(eval("[1,,]"))
|
||||
except SyntaxError:
|
||||
|
@ -1,3 +1,11 @@
|
||||
# test builtin exec
|
||||
|
||||
try:
|
||||
exec
|
||||
except NameError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
print(exec("def foo(): return 42"))
|
||||
print(foo())
|
||||
|
||||
|
@ -1,5 +1,11 @@
|
||||
# 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
|
||||
args = {'thisisaverylongargumentname': 123}
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
# test the lexer
|
||||
|
||||
try:
|
||||
eval
|
||||
exec
|
||||
except NameError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
# __debug__ is a special symbol
|
||||
print(type(__debug__))
|
||||
|
||||
|
@ -1,5 +1,11 @@
|
||||
# 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
|
||||
# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
|
||||
def f4(*vargs, **kwargs):
|
||||
|
@ -1,5 +1,11 @@
|
||||
# test syntax errors
|
||||
|
||||
try:
|
||||
exec
|
||||
except NameError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
def test_syntax(code):
|
||||
try:
|
||||
exec(code)
|
||||
|
@ -1,7 +1,8 @@
|
||||
# test that iterating doesn't use the heap
|
||||
try:
|
||||
frozenset
|
||||
import array
|
||||
except ImportError:
|
||||
except (NameError, ImportError):
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user