tests/basic: Make various tests skippable.
This commit is contained in:
parent
52b6764894
commit
983144404b
|
@ -1,4 +1,10 @@
|
||||||
# test builtin property
|
# test builtin property
|
||||||
|
try:
|
||||||
|
property
|
||||||
|
except:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# create a property object explicitly
|
# create a property object explicitly
|
||||||
property()
|
property()
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
# test builtin sorted
|
# test builtin sorted
|
||||||
|
try:
|
||||||
|
sorted
|
||||||
|
set
|
||||||
|
except:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
print(sorted(set(range(100))))
|
print(sorted(set(range(100))))
|
||||||
print(sorted(set(range(100)), key=lambda x: x + 100*(x % 2)))
|
print(sorted(set(range(100)), key=lambda x: x + 100*(x % 2)))
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
# test construction of bytearray from different objects
|
# test construction of bytearray from different objects
|
||||||
|
|
||||||
from array import array
|
|
||||||
|
|
||||||
# bytes, tuple, list
|
# bytes, tuple, list
|
||||||
print(bytearray(b'123'))
|
print(bytearray(b'123'))
|
||||||
print(bytearray((1, 2)))
|
print(bytearray((1, 2)))
|
||||||
print(bytearray([1, 2]))
|
print(bytearray([1, 2]))
|
||||||
|
|
||||||
# arrays
|
|
||||||
print(bytearray(array('b', [1, 2])))
|
|
||||||
print(bytearray(array('h', [0x101, 0x202])))
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# test construction of bytearray from different objects
|
||||||
|
try:
|
||||||
|
from array import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
# arrays
|
||||||
|
print(bytearray(array('b', [1, 2])))
|
||||||
|
print(bytearray(array('h', [0x101, 0x202])))
|
|
@ -1,6 +1,10 @@
|
||||||
# test construction of bytearray from different objects
|
# test construction of bytearray from different objects
|
||||||
|
try:
|
||||||
from array import array
|
from array import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# arrays
|
# arrays
|
||||||
print(bytearray(array('h', [1, 2])))
|
print(bytearray(array('h', [1, 2])))
|
||||||
|
|
|
@ -2,10 +2,3 @@
|
||||||
|
|
||||||
print(b"123" + b"456")
|
print(b"123" + b"456")
|
||||||
print(b"123" + bytearray(2))
|
print(b"123" + bytearray(2))
|
||||||
|
|
||||||
import array
|
|
||||||
|
|
||||||
# should be byteorder-neutral
|
|
||||||
print(b"123" + array.array('h', [0x1515]))
|
|
||||||
|
|
||||||
print(b"\x01\x02" + array.array('b', [1, 2]))
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
# test bytes + other
|
||||||
|
try:
|
||||||
|
import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
# should be byteorder-neutral
|
||||||
|
print(b"123" + array.array('h', [0x1515]))
|
||||||
|
|
||||||
|
print(b"\x01\x02" + array.array('b', [1, 2]))
|
|
@ -1,5 +1,9 @@
|
||||||
# test bytes + other
|
# test bytes + other
|
||||||
|
try:
|
||||||
import array
|
import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
print(b"123" + array.array('i', [1]))
|
print(b"123" + array.array('i', [1]))
|
||||||
|
|
|
@ -3,9 +3,3 @@ print(b"123" == bytearray(b"123"))
|
||||||
print(b'123' < bytearray(b"124"))
|
print(b'123' < bytearray(b"124"))
|
||||||
print(b'123' > bytearray(b"122"))
|
print(b'123' > bytearray(b"122"))
|
||||||
print(bytearray(b"23") in b"1234")
|
print(bytearray(b"23") in b"1234")
|
||||||
|
|
||||||
import array
|
|
||||||
|
|
||||||
print(array.array('b', [1, 2]) in b'\x01\x02\x03')
|
|
||||||
# CPython gives False here
|
|
||||||
#print(b"\x01\x02\x03" == array.array("B", [1, 2, 3]))
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
try:
|
||||||
|
import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
print(array.array('b', [1, 2]) in b'\x01\x02\x03')
|
||||||
|
# CPython gives False here
|
||||||
|
#print(b"\x01\x02\x03" == array.array("B", [1, 2, 3]))
|
|
@ -1,16 +1,10 @@
|
||||||
# test construction of bytes from different objects
|
# test construction of bytes from different objects
|
||||||
|
|
||||||
from array import array
|
|
||||||
|
|
||||||
# tuple, list, bytearray
|
# tuple, list, bytearray
|
||||||
print(bytes((1, 2)))
|
print(bytes((1, 2)))
|
||||||
print(bytes([1, 2]))
|
print(bytes([1, 2]))
|
||||||
print(bytes(bytearray(4)))
|
print(bytes(bytearray(4)))
|
||||||
|
|
||||||
# arrays
|
|
||||||
print(bytes(array('b', [1, 2])))
|
|
||||||
print(bytes(array('h', [0x101, 0x202])))
|
|
||||||
|
|
||||||
# constructor value out of range
|
# constructor value out of range
|
||||||
try:
|
try:
|
||||||
bytes([-1])
|
bytes([-1])
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# test construction of bytes from different objects
|
||||||
|
try:
|
||||||
|
from array import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
# arrays
|
||||||
|
print(bytes(array('b', [1, 2])))
|
||||||
|
print(bytes(array('h', [0x101, 0x202])))
|
|
@ -1,6 +1,11 @@
|
||||||
# test construction of bytes from different objects
|
# test construction of bytes from different objects
|
||||||
|
|
||||||
from array import array
|
try:
|
||||||
|
from array import array
|
||||||
|
except ImportError:
|
||||||
|
import sys
|
||||||
|
print("SKIP")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# arrays
|
# arrays
|
||||||
print(bytes(array('h', [1, 2])))
|
print(bytes(array('h', [1, 2])))
|
||||||
|
|
Loading…
Reference in New Issue