Commit 67c77e97 authored by Damien George's avatar Damien George
Browse files

leon: Update leon-tests from upstream tests.

parent d865f67b
try:
enumerate
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit
print(list(enumerate([])))
print(list(enumerate([1, 2, 3])))
......
try:
filter
except:
import sys
print("SKIP")
sys.exit()
raise SystemExit
print(list(filter(lambda x: x & 1, range(-3, 4))))
print(list(filter(None, range(-3, 4))))
# test builtin hash function, on generators
def gen():
yield
print(type(hash(gen)))
print(type(hash(gen())))
True
False
True
True
True
True
True
True
True
True
True
False
TypeError
# test binary operations on range objects; (in)equality only
# this "feature test" actually tests the implementation but is the best we can do
if range(1) != range(1):
print("SKIP")
raise SystemExit
# basic (in)equality
print(range(1) == range(1))
print(range(1) != range(1))
print(range(1) != range(2))
# empty range
print(range(0) == range(0))
print(range(1, 0) == range(0))
print(range(1, 4, -1) == range(6, 3))
# 1 element range
print(range(1, 4, 10) == range(1, 4, 10))
print(range(1, 4, 10) == range(1, 4, 20))
print(range(1, 4, 10) == range(1, 8, 20))
# more than 1 element
print(range(0, 3, 2) == range(0, 3, 2))
print(range(0, 3, 2) == range(0, 4, 2))
print(range(0, 3, 2) == range(0, 5, 2))
# unsupported binary op
try:
range(1) + 10
except TypeError:
print('TypeError')
123
56
TypeError
AttributeError/TypeError
......@@ -16,3 +16,10 @@ try:
setattr(a, b'var3', 1)
except TypeError:
print('TypeError')
# try setattr on a built-in function
try:
setattr(int, 'to_bytes', 1)
except (AttributeError, TypeError):
# uPy raises AttributeError, CPython raises TypeError
print('AttributeError/TypeError')
......@@ -3,8 +3,7 @@ try:
set
except NameError:
print("SKIP")
import sys
sys.exit()
raise SystemExit
print(list(zip()))
print(list(zip([1], set([2, 3]))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment