Commit 83623b2f authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

tests/basic/[a-f]*: Make skippable.

For small ports which don't have all features enabled.
parent 453f9891
# test MicroPython-specific features of array.array
import array
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
# arrays of objects
a = array.array('O')
......
......@@ -4,6 +4,15 @@
import sys
t = sys.implementation
# It can be just a normal tuple on small ports
try:
t.name
except AttributeError:
import sys
print("SKIP")
sys.exit()
# test printing of attrtuple
print(str(t).find("version=") > 0)
......
# test builtin delattr
try:
delattr
except:
import sys
print("SKIP")
sys.exit()
class A: pass
a = A()
......
# test builtin min and max functions
try:
min
max
except:
import sys
print("SKIP")
sys.exit()
print(min(0,1))
print(min(1,0))
......
......@@ -3,7 +3,13 @@
import builtins
# override generic builtin
builtins.abs = lambda x: x + 1
try:
builtins.abs = lambda x: x + 1
except AttributeError:
import sys
print("SKIP")
sys.exit()
print(abs(1))
# __build_class__ is handled in a special way
......
......@@ -34,11 +34,6 @@ print(range(1, 4)[1:])
print(range(1, 4)[:-1])
print(range(7, -2, -4)[:])
# attrs
print(range(1, 2, 3).start)
print(range(1, 2, 3).stop)
print(range(1, 2, 3).step)
# bad unary op
try:
-range(1)
......@@ -50,9 +45,3 @@ try:
range(1)[0] = 1
except TypeError:
print("TypeError")
# bad attr (can't store)
try:
range(4).start = 0
except AttributeError:
print('AttributeError')
# test attributes of builtin range type
try:
range(0).start
except AttributeError:
import sys
print("SKIP")
sys.exit()
# attrs
print(range(1, 2, 3).start)
print(range(1, 2, 3).stop)
print(range(1, 2, 3).step)
# bad attr (can't store)
try:
range(4).start = 0
except AttributeError:
print('AttributeError')
# test the builtin reverse() function
try:
reversed
except:
import sys
print("SKIP")
sys.exit()
# list
print(list(reversed([])))
......
......@@ -18,6 +18,13 @@ class Main:
Forward = Descriptor()
m = Main()
try:
m.__class__
except AttributeError:
import sys
print("SKIP")
sys.exit()
r = m.Forward
if 'Descriptor' in repr(r.__class__):
print('SKIP')
......
try:
# If we don't expose object.__new__ (small ports), there's
# nothing to test.
object.__new__
except AttributeError:
import sys
print("SKIP")
sys.exit()
class A:
def __new__(cls):
print("A.__new__")
......
......@@ -5,7 +5,12 @@
try:
from collections import namedtuple
except ImportError:
from ucollections import namedtuple
try:
from ucollections import namedtuple
except ImportError:
import sys
print("SKIP")
sys.exit()
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])
......
# Calling object.__init__() via super().__init__
try:
# If we don't expose object.__init__ (small ports), there's
# nothing to test.
object.__init__
except AttributeError:
import sys
print("SKIP")
sys.exit()
class Test(object):
def __init__(self):
......
......@@ -9,5 +9,6 @@ l.sort()
print(l)
# argument to fromkeys has no __len__
d = dict.fromkeys(reversed(range(1)))
#d = dict.fromkeys(reversed(range(1)))
d = dict.fromkeys((x for x in range(1)))
print(d)
try:
enumerate
except:
import sys
print("SKIP")
sys.exit()
print(list(enumerate([])))
print(list(enumerate([1, 2, 3])))
print(list(enumerate([1, 2, 3], 5)))
......
try:
filter
except:
import sys
print("SKIP")
sys.exit()
print(list(filter(lambda x: x & 1, range(-3, 4))))
print(list(filter(None, range(-3, 4))))
Supports Markdown
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