tests/array*: Allow to skip test if "array" is unavailable.
This commit is contained in:
parent
e5a6a26330
commit
ef1bbada96
@ -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))
|
||||
|
@ -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])
|
||||
|
@ -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)))
|
||||
|
@ -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))))
|
||||
|
@ -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'))
|
||||
|
@ -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'))
|
||||
|
Loading…
Reference in New Issue
Block a user