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

pull/2554/merge
Paul Sokolovsky 2017-01-07 01:13:40 +03:00
rodzic e5a6a26330
commit ef1bbada96
6 zmienionych plików z 36 dodań i 6 usunięć

Wyświetl plik

@ -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))

Wyświetl plik

@ -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])

Wyświetl plik

@ -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)))

Wyświetl plik

@ -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))))

Wyświetl plik

@ -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'))

Wyświetl plik

@ -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'))