tests/basics: Split out specific bytearray tests to separate files.

So they can be automatically skipped if bytearray is not enabled.
pull/5227/head
Damien George 2019-10-29 21:24:51 +11:00
rodzic 6e9ba1cf4b
commit aeea204e98
8 zmienionych plików z 32 dodań i 22 usunięć

Wyświetl plik

@ -1,8 +1,6 @@
# test bytes + other
print(b"123" + b"456")
print(b"123" + bytearray(2))
print(b"123" + b"") # RHS is empty, can be optimised
print(b"" + b"123") # LHS is empty, can be optimised
print(b"" + bytearray(1)) # LHS is empty but can't be optimised

Wyświetl plik

@ -0,0 +1,5 @@
# test bytes + bytearray
print(b"123" + bytearray(2))
print(b"" + bytearray(1)) # LHS is empty but can't be optimised

Wyświetl plik

@ -1,5 +1 @@
print(b"1" == 1)
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")

Wyświetl plik

@ -0,0 +1,4 @@
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")

Wyświetl plik

@ -1,9 +1,8 @@
# test construction of bytes from different objects
# tuple, list, bytearray
# tuple, list
print(bytes((1, 2)))
print(bytes([1, 2]))
print(bytes(bytearray(4)))
# constructor value out of range
try:

Wyświetl plik

@ -0,0 +1,3 @@
# test construction of bytes from bytearray
print(bytes(bytearray(4)))

Wyświetl plik

@ -13,10 +13,6 @@ try:
~[]
except TypeError:
print('TypeError')
try:
~bytearray()
except TypeError:
print('TypeError')
# unsupported binary operators
try:
@ -31,16 +27,6 @@ try:
1 in 1
except TypeError:
print('TypeError')
try:
bytearray() // 2
except TypeError:
print('TypeError')
# object with buffer protocol needed on rhs
try:
bytearray(1) + 1
except TypeError:
print('TypeError')
# unsupported subscription
try:

Wyświetl plik

@ -0,0 +1,19 @@
# test errors from bad operations (unary, binary, etc)
# unsupported unary operators
try:
~bytearray()
except TypeError:
print('TypeError')
# unsupported binary operators
try:
bytearray() // 2
except TypeError:
print('TypeError')
# object with buffer protocol needed on rhs
try:
bytearray(1) + 1
except TypeError:
print('TypeError')