Commit 98314440 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

tests/basic: Make various tests skippable.

parent 52b67648
# test builtin property
try:
property
except:
import sys
print("SKIP")
sys.exit()
# create a property object explicitly
property()
......
# test builtin sorted
try:
sorted
set
except:
import sys
print("SKIP")
sys.exit()
print(sorted(set(range(100))))
print(sorted(set(range(100)), key=lambda x: x + 100*(x % 2)))
......
# test construction of bytearray from different objects
from array import array
# bytes, tuple, list
print(bytearray(b'123'))
print(bytearray((1, 2)))
print(bytearray([1, 2]))
# arrays
print(bytearray(array('b', [1, 2])))
print(bytearray(array('h', [0x101, 0x202])))
# 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])))
# test construction of bytearray from different objects
from array import array
try:
from array import array
except ImportError:
import sys
print("SKIP")
sys.exit()
# arrays
print(bytearray(array('h', [1, 2])))
......
......@@ -2,10 +2,3 @@
print(b"123" + b"456")
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]))
# 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]))
# test bytes + other
import array
try:
import array
except ImportError:
import sys
print("SKIP")
sys.exit()
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"122"))
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]))
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]))
# test construction of bytes from different objects
from array import array
# tuple, list, bytearray
print(bytes((1, 2)))
print(bytes([1, 2]))
print(bytes(bytearray(4)))
# arrays
print(bytes(array('b', [1, 2])))
print(bytes(array('h', [0x101, 0x202])))
# constructor value out of range
try:
bytes([-1])
......
# 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])))
# 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
print(bytes(array('h', [1, 2])))
......
Supports Markdown
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