Skip to content

Commit 9831444

Browse files
committed
tests/basic: Make various tests skippable.
1 parent 52b6764 commit 9831444

13 files changed

Lines changed: 75 additions & 30 deletions

tests/basics/builtin_property.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# test builtin property
2+
try:
3+
property
4+
except:
5+
import sys
6+
print("SKIP")
7+
sys.exit()
28

39
# create a property object explicitly
410
property()

tests/basics/builtin_sorted.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# test builtin sorted
2+
try:
3+
sorted
4+
set
5+
except:
6+
import sys
7+
print("SKIP")
8+
sys.exit()
29

310
print(sorted(set(range(100))))
411
print(sorted(set(range(100)), key=lambda x: x + 100*(x % 2)))
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# test construction of bytearray from different objects
22

3-
from array import array
4-
53
# bytes, tuple, list
64
print(bytearray(b'123'))
75
print(bytearray((1, 2)))
86
print(bytearray([1, 2]))
9-
10-
# arrays
11-
print(bytearray(array('b', [1, 2])))
12-
print(bytearray(array('h', [0x101, 0x202])))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# test construction of bytearray from different objects
2+
try:
3+
from array import array
4+
except ImportError:
5+
import sys
6+
print("SKIP")
7+
sys.exit()
8+
9+
# arrays
10+
print(bytearray(array('b', [1, 2])))
11+
print(bytearray(array('h', [0x101, 0x202])))

tests/basics/bytearray_construct_endian.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# test construction of bytearray from different objects
2-
3-
from array import array
2+
try:
3+
from array import array
4+
except ImportError:
5+
import sys
6+
print("SKIP")
7+
sys.exit()
48

59
# arrays
610
print(bytearray(array('h', [1, 2])))

tests/basics/bytes_add.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,3 @@
22

33
print(b"123" + b"456")
44
print(b"123" + bytearray(2))
5-
6-
import array
7-
8-
# should be byteorder-neutral
9-
print(b"123" + array.array('h', [0x1515]))
10-
11-
print(b"\x01\x02" + array.array('b', [1, 2]))

tests/basics/bytes_add_array.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# test bytes + other
2+
try:
3+
import array
4+
except ImportError:
5+
import sys
6+
print("SKIP")
7+
sys.exit()
8+
9+
# should be byteorder-neutral
10+
print(b"123" + array.array('h', [0x1515]))
11+
12+
print(b"\x01\x02" + array.array('b', [1, 2]))

tests/basics/bytes_add_endian.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# test bytes + other
2-
3-
import array
2+
try:
3+
import array
4+
except ImportError:
5+
import sys
6+
print("SKIP")
7+
sys.exit()
48

59
print(b"123" + array.array('i', [1]))

tests/basics/bytes_compare2.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@
33
print(b'123' < bytearray(b"124"))
44
print(b'123' > bytearray(b"122"))
55
print(bytearray(b"23") in b"1234")
6-
7-
import array
8-
9-
print(array.array('b', [1, 2]) in b'\x01\x02\x03')
10-
# CPython gives False here
11-
#print(b"\x01\x02\x03" == array.array("B", [1, 2, 3]))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
try:
2+
import array
3+
except ImportError:
4+
import sys
5+
print("SKIP")
6+
sys.exit()
7+
8+
print(array.array('b', [1, 2]) in b'\x01\x02\x03')
9+
# CPython gives False here
10+
#print(b"\x01\x02\x03" == array.array("B", [1, 2, 3]))

0 commit comments

Comments
 (0)