Commit ef1bbada authored by Paul Sokolovsky's avatar Paul Sokolovsky

tests/array*: Allow to skip test if "array" is unavailable.

parent e5a6a263
import array
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
a = array.array('B', [1, 2, 3])
print(a, len(a))
......
# test array + array
import array
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
a1 = array.array('I', [1])
a2 = array.array('I', [2])
......
# test construction of array.array from different objects
from array import array
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
# tuple, list
print(array('b', (1, 2)))
......
from array import array
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
# construct from something with unknown length (requires generators)
print(array('i', (i for i in range(10))))
# test construction of array.array from different objects
from array import array
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
# raw copy from bytes, bytearray
print(array('h', b'12'))
# test array('q') and array('Q')
from array import array
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
print(array('q'))
print(array('Q'))
......
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