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

pull/1/head
Paul Sokolovsky 2017-01-07 01:13:40 +03:00
parent e5a6a26330
commit ef1bbada96
6 changed files with 36 additions and 6 deletions

View File

@ -1,4 +1,9 @@
import array
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
a = array.array('B', [1, 2, 3])
print(a, len(a))

View File

@ -1,5 +1,10 @@
# 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])

View File

@ -1,6 +1,11 @@
# 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)))

View File

@ -1,4 +1,9 @@
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))))

View File

@ -1,6 +1,11 @@
# 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'))

View File

@ -1,6 +1,11 @@
# 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'))